@EnableOpenApi
@EnableWebMvc //不写这个SpringBoot必报错
//@ComponentScan(basePackages = {"com.ning.server.controller"})
@Configuration
@EnableSwagger2
1、@EnableOpenApi 这个注解Maven主仓里面还搜不到
所以@EnableWebMvc=继承DelegatingWebMvcConfiguration=继承WebMvcConfigurationSupport
WebMvcConfigurationSupport的首要功能,是检测运行环境给出一套缺省配置。最终这套配置表现为一组注册到容器的bean。其次WebMvcConfigurationSupport在定义这些bean的过程中,调用了子类可以覆盖实现的配置原料提供方法,从而提供给了子类定制化Spring MVC配置的能力。
具体解释:一次跨域配置记录@EnableWebMvc、WebMvcConfigurationSupport、WebMvcConfigurer、DelegatingWebMvcConfiguration_不想打代码的码农的博客-CSDN博客
2、@EnableWebMvc //不写这个SpringBoot报错如下:
ERROR 4368 --- [ main] o.s.boot.SpringApplication : Application run failed
Caused by: java.lang.NullPointerException: null
3、swagger-ui 3 的路径变成这个了:/swagger-ui/index.html.
// 6、放行路径(不走拦截链)
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers(
"/swagger-ui/**",


