报错问题:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [com.hmall.gateway.GatewayApplication]; nested exception is java.io.FileNotFoundException: class path resource [org/springframework/web/servlet/config/annotation/WebMvcConfigurer.class] cannot be opened because it does not exist
在spring.factories配置自动装配配置类
问题原因:因为网关没有引入SpringMVC,直接不会成效,会报错,写这个注解,有SpringMVC时候才生效
解决方案:在MVC配置类加上“@ConditionalOnClass(DispatcherServlet.class)”主页,表示使用mvc才加载这个配置