栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

jwt token swagger3 SpringBoot2.6.2 真坑啊(记录3)

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

jwt token swagger3 SpringBoot2.6.2 真坑啊(记录3)

 Swagger2Config 里面要加这些注解


@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/**",
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/679039.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号