controller层接入swagger
Filterfilter拦截设置
private static boolean matches(String lookupPath){ if (!ObjectUtils.isEmpty(noNeedLoginUrlList)) {
for (String pattern : noNeedLoginUrlList) {
if (pathMatcher.match(pattern, lookupPath)) {
return false;
}
}
}
return true;
}
private static PathMatcher pathMatcher = new AntPathMatcher();
//
public static Set<String> noNeedLoginUrlList = new HashSet<String>();
static {
// swagger资源过滤勿动
noNeedLoginUrlList.add("/swagger*");
noNeedLoginUrlList.add("/webjars/springfox-swagger-ui/*");
noNeedLoginUrlList.add("/swagger-resources/*");
noNeedLoginUrlList.add("/v2/api-docs");
}
以上是 controller层接入swagger 的全部内容, 来源链接: utcz.com/z/516619.html