-
Notifications
You must be signed in to change notification settings - Fork 41k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document that RouterFunction beans in the context cannot be used with @WebFluxTest #10683
Comments
@wilkinsona those are usually defined within a |
And now that you've asked, I'm wondering too. Without support in the Framework for filtering the beans produced by a configuration class that's similar to the filtering offered for component scanning, I can't think how we can do it. |
It's worse than that even. The router is linked to one or more handlers. I think a good match in that world would be to split routers per area and the slice is the router. But even if you have that you need to add the handler beans. And those are regular components with methods in them. So we would have to scan the injection point upfront to add them. Sounds quite complicated. |
@wilkinsona removing from the 2.0 bucket as I don't see a way to implement this at the moment. Worth considering in par with the "programmatic/explicit configuration" |
Hello there ! |
No news at this time (this issue would have been updated if there was). As things stand, we don't think it's possible to do what we'd like, certainly not without some changes in Spring Framework and maybe not at all. |
If it can help people who are using functional endpoints as I do. I so finally test them by this way :
The WebFluxTest annotation keep avoid to load other things than RestController and I customize the ContextConfiguration to load my functional endpoints. |
Hello there! I tried the below and It works for me. @WebFluxTest(controllers = {RouteConfiguration.class, UserHandler.class})
public class UserHandlerTest {
@Autowired
private WebTestClient testClient;
@MockBean(name="userService")
private UserService userService;
...
} |
I confirm. My Boot is at 3.2.3 |
No description provided.
The text was updated successfully, but these errors were encountered: