The SpringCloud Gateway project is being built by the SpringCloud Gateway project.
***************************
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.
Copy the code
According to the above Description, the ServerCodecConfig Bean cannot be found in the GatewayAutoConfiguration configuration.
See how source, springBoot loaded at startup to its configuration, one of them called GatewayClassPathWarningAutoConfiguration configuration classes have so one line of code:
@Configuration @ConditionalOnClass(name = "org.springframework.web.servlet.DispatcherServlet") protected static class SpringMvcFoundOnClasspathConfiguration { public SpringMvcFoundOnClasspathConfiguration() { log.warn(BORDER+"Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. "+ "Please remove spring-boot-starter-web dependency."+BORDER); }}Copy the code
Log.warn, which translates as “Spring MVC found on the classpath, is incompatible with the Spring Cloud gateway at this time. Please remove the spring-boot-start-web dependency.” .
Because the Spring Cloud Gateway is based on WebFlux, if web support is required, you need to import Spring-boot-starter-webflux instead of spring-boot-start-Web. We can simply remove the JAR dependency on the Spring-boot-start-Web module from pop.xml.
There will be a lot of compatibility problems in SpringCloud project, which will be very troublesome at the beginning, but with more patience, you will learn a lot of different knowledge.
I am the advanced ball, let’s climb the pit in 2019. Feel to share very force words to praise, thank you!! If you have any questions, please leave a message below.