【发布时间】:2020-10-09 09:15:59
【问题描述】:
我们使用的依赖是openapi的pom如下:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-common</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.1.2</version>
</dependency>
这个 pom 也有来自其他项目的依赖项,并且那些其他项目是 java maven 项目。
我什至尝试对 webSecurityConfiguration 类进行更改,如下所述:
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers("/v3/api-docs/**", "/swagger-ui.html", "/swagger-ui/**","/webjars/swagger-ui/**")
}
点击网址 http://localhost:8081/v3/api-docs 或 http://localhost:8081/swagger-ui.html 我收到此错误:
此 XML 文件似乎没有任何关联的样式信息。文档树如下所示。
在 SecurityContext 中找不到身份验证对象
未经授权
【问题讨论】:
-
请确保具有
configure(WebSecuirty web)方法的类扩展了WebSecurityConfigurerAdapter并具有@Configuration注释。 -
所有这些注释都已经放好了。
-
服务器日志中有异常吗?如果是这样,请将它们添加到问题中。
-
能否请您提供您的招摇配置?