Swagger2 - 找不到 GET 的处理程序

vis*_*era 5 java swagger swagger-ui spring-boot swagger-2.0

我在Spring boot. 我故意使用Swagger2来简化technical文档。现在,我遇到了一个问题,这主要是由我们的整个 API 引起的。它经常打印日志。1 分钟内就到了。创建 2-5 MB 日志。这是绝对不能接受的。由于下面提到的错误。

我坚信,这是因为 Swagger UI 配置。它正在出现。

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /null/swagger-resources/configuration/security

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /null/swagger-resources

org.springframework.web.servlet.NoHandlerFoundException: No handler found for GET /null/swagger-resources/configuration/ui
Run Code Online (Sandbox Code Playgroud)

我已经配置为绕过endpoints我的“ Authentication/Authorization”检查中的以下内容validation。

1. /swagger-ui.html
2. /v2/api-docs
3. /swagger-resources/configuration/ui
4. /swagger-resources
5. /swagger-resources/configuration/security
Run Code Online (Sandbox Code Playgroud)

问题是,为什么它在内部调用以/null前缀开头的端点(请参阅上面提到的在我的日志中打印的 3 个错误语句)

法衣!& 有趣的!对我来说,事情是,它只在我的一个( )中发生(导致) 。而在其他情况下,它工作得很好,无需抛出任何此类.environmentDEV, TEST, PRODenvironmenterrors

注意- 我只启用swagger了DEV & LOCAL env.。可能是由于这个原因,它没有分别给出任何error内容TEST & PROD。我再次不确定发生了什么问题。

甚至,在我的本地也没有给出任何错误!

我正在使用以下 Maven 依赖项来启用 swagger,

<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.8.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.8.0</version>
        </dependency> 
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激!

小智 2

升级到 swagger 3 解决了我的问题。此链接可能有用。