You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
With Spring MVC being the most popular option to build spring web apps, users are likely to try using this project in combination with Spring MVC (spring-boot-starter-web specifically). The fact that this project brings Spring Webflux does not matter unfortunately as Spring Boot starts up in Servlet mode when both web and webflux are on the classpath.
While this is an invalid combination, the failure analysis on startup is too low level and doesn't indicate to the user what is wrong with their setup:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method modifyRequestBodyGatewayFilterFactory in org.springframework.cloud.gateway.config.GatewayAutoConfiguration required a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.http.codec.ServerCodecConfigurer' in your configuration.
This looks like an oversight of a more general approach as starting the app with a more narrowed web application type leads to:
**********************************************************
Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency.
**********************************************************
Describe the solution you'd like
Backing off completely sounds heading in the opposite direction given users opting-in for this project. Perhaps the auto-configuration could have a check on MVC and throw a dedicated exception? This exception can have a dedicated failure analyzer that would provide a more precise explanation about the setup and why it is invalid.
An action could be that spring.main.web-application-type should be set to reactive. However, given the warning above, that doesn't sound great so for consistency I guess we should ask the user to remove the dependency.
Describe alternatives you've considered
Backing off completely doesn't sound like a good idea.
Thanks for the update @spencergibb. I believe this change is a bit too broad, especially considering that Spring Boot supports starting a reactive web server even if Spring MVC is present on the classpath.
With Spring Cloud 2020.0.2, having both MVC and WebFlux on the classpath isn't a problem as long as the user has opt-in for WebFlux using spring.main.web-application-type=reactive.
With Spring Cloud 2020.0.3-SNAPSHOT and the same setup, I get:
***************************
APPLICATION FAILED TO START
***************************
Description:
Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway.
Action:
Please remove spring-boot-starter-web dependency.
With this change, the only solutions I found are to remove Spring MVC or disable Spring Cloud Gateway. Was this intended?
Gateway has narrower constraints than a general boot app (doesn't support tomcat yet for example). I can add setting the type to reactive as a suggestion, assuming it works (will need to test it).
Is your feature request related to a problem? Please describe.
With Spring MVC being the most popular option to build spring web apps, users are likely to try using this project in combination with Spring MVC (
spring-boot-starter-web
specifically). The fact that this project brings Spring Webflux does not matter unfortunately as Spring Boot starts up in Servlet mode when both web and webflux are on the classpath.While this is an invalid combination, the failure analysis on startup is too low level and doesn't indicate to the user what is wrong with their setup:
This looks like an oversight of a more general approach as starting the app with a more narrowed web application type leads to:
Describe the solution you'd like
Backing off completely sounds heading in the opposite direction given users opting-in for this project. Perhaps the auto-configuration could have a check on MVC and throw a dedicated exception? This exception can have a dedicated failure analyzer that would provide a more precise explanation about the setup and why it is invalid.
An action could be that
spring.main.web-application-type
should be set toreactive
. However, given the warning above, that doesn't sound great so for consistency I guess we should ask the user to remove the dependency.Describe alternatives you've considered
Backing off completely doesn't sound like a good idea.
Additional context
spring-io/start.spring.io#653
The text was updated successfully, but these errors were encountered: