问题解决
md,他会默认把你的资源都给你拦截了,在spring security的配置类直接加上这个。
// 解决,加了security之后会拦截swagger资源,用这个放行
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers(
"/login",
"/logout",
"/css/**",
"/js/**",
"/index.html",
"favicon.ico",
"/doc.html",
"/webjars/**",
"/swagger-resources/**",
"/v2/api-docs/**"
);
}