原创

Springboot添加Swagger

Swagger

配置springfox-boot-starter

<dependency>
   <groupId>io.springfox</groupId>
   <artifactId>springfox-boot-starter</artifactId>
   <version>${swagger.fox.version}</version>
 </dependency>

Spring security配置过滤swagger相关请求

httpSecurity.csrf().disable().cors()
     .and()
     .authorizeRequests()
     .antMatchers("/swagger-resources/**","/swagger-ui/**", "/v3/**", "/error").permitAll()
     .anyRequest().authenticated()

前端报错404

request路径多了一个字母,肉眼看不出来,编辑器比对出来的

参考

Swagger3被拦截器拦截并报错Unable to infer base url或者Unable to render this definition_JSluck的博客-CSDN博客

https://blog.csdn.net/sluck_0430/article/details/124179540

正文到此结束