本文共 650 字,大约阅读时间需要 2 分钟。
权限认证框架会拦截swagger文档api,无法访问。
swagger访问文档路径:http://ip:port/swagger-ui.html swagger-boostrap-ui访问文档路径:http://ip:port/doc.html SpringSecurity配置忽略以上路径和swagger静态资源代码如下: WebSecurityConfiguration.java文件@Override public void configure(WebSecurity web) throws Exception { web.ignoring() .antMatchers(AUTH_WHITELIST); // 忽略swagger ui静态资源 } // -- swagger ui忽略 private static final String[] AUTH_WHITELIST = { // -- swagger ui "/swagger-resources/**", "/swagger-ui.html", "/v2/api-docs", "/webjars/**", // swagger-boostrap-ui "/doc.html" };
转载地址:http://aviwi.baihongyu.com/