-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Can't use RouterFunction and RestController together [SPR-15405] #19968
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
Comments
Brian Clozel commented The main goal with the WebFlux setup is to create a We could wire Let's take an actual example, what if we define the following in our application:
No matter how we order/mix both variants, there are many cases where we could argue one way or the other; which handler should take care of a given request? Given the core differences between both ways of routing requests, we can't really blend those into one as one is about patterns specificity and the other about functions. My current vote is to not support this use case, but I'll let Arjen Poutsma, Sébastien Deleuze and Rossen Stoyanchev comment as well. |
Brian Clozel commented TL;DR: this is supported but not actively promoted, since developers have to live with quite a few trade-offs and a good understanding of the Spring WebFlux internals. Rossen Stoyanchev just pointed me to router functions implementations for So technically, you can declare a few additional beans in your application configuration - given you've already configured the annotation variant, probably with With that setup, you can use both annotation and functional, but you have to live with the following limitations:
Jonathan Borenstein, let us know if that's what you were looking for and how that arrangement works in your application. Thanks! |
Rossen Stoyanchev commented Yes the simplest path is probably In the absence of an |
Arjen Poutsma commented Note that I've just completed work on #20095, which should make it a lot easier to combine controllers and router functions in one app. Just using |
Brian Clozel commented This has been reflected in Spring Boot and as of 2.0.0.M2. |
Jonathan Borenstein opened SPR-15405 and commented
If you have a routerfunction, no matter where you map it to, you can't have a RestController in your application.
You either choose one or the other. Why not both? Or is this by design?
Affects: 5.0 M5
Issue Links:
0 votes, 6 watchers
The text was updated successfully, but these errors were encountered: