Spring security集成swagger2 无法访问的问题

之前是这样配置的用不了点不开接口

//过滤掉swagger的路径
 http.authorizeRequests().antMatchers("/v2/api-docs", "/configuration/ui", "/swagger-resources/**", "/configuration/security", "/swagger-ui.html", "/webjars/**").anonymous();

后来开启csrf().disable(); 就可以了我也不知道是为啥

http.authorizeRequests().antMatchers("/v2/api-docs", "/configuration/ui", "/swagger-resources/**", "/configuration/security", "/swagger-ui.html", "/webjars/**").anonymous()
 .and() .csrf().disable();

你可能感兴趣的:(Spring security集成swagger2 无法访问的问题)