英文:
springdoc-openui swagger url default to petstore api and not disabling
问题
我正在使用 springdoc-openapi-starter-webmvc-ui 依赖和 spring boot 版本为 3.0.2,使用 JDK 17,但是当我访问 http://localhost:8080/swagger-ui/index.html 时,显示的是默认的 petstore API,而不是我的应用程序 API。
以下是我正在使用的依赖项:
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.2</version>
<exclusions>
<exclusion>
<artifactId>org.webjars</artifactId>
<groupId>swagger-ui</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.webjars/swagger-ui -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>4.8.1</version>
</dependency>
还有在 application.yaml
中的配置:
springdoc:
swagger-ui:
path: '/swagger-ui.html'
disable-swagger-default-url: true
但似乎在这种情况下 disable-swagger-default-url 不起作用。请告诉我如何摆脱这个默认的 petstore API 并能够访问我的应用程序 API。
英文:
I am using springdoc-openapi-starter-webmvc-ui dependency and spring boot version is 3.0.2 with JDK 17 but when I am hitting http://localhost:8080/swagger-ui/index.html its showing default petstore API not my application API..
Below are the dependencies which I am using :
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.0.2</version>
<exclusions>
<exclusion>
<artifactId>org.webjars</artifactId>
<groupId>swagger-ui</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.webjars/swagger-ui -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>4.8.1</version>
</dependency>
and in application.yaml
springdoc:
swagger-ui:
path: '/swagger-ui.html'
disable-swagger-default-url: true
but it seems disable-swagger-default-url is not working in this case. Please let me know how can I get rid of this default petstore api and able to hit my application api.
答案1
得分: 1
yaml文件中的配置是正确的,也许你应该将springdoc-openapi-starter-webmvc-ui
的版本升级到2.1.0,然后可以从pom文件中删除有关swagger-ui
依赖的相关配置。希望这有所帮助。
英文:
The configuration in yaml file is correct, maybe you should upgrade the version of springdoc-openapi-starter-webmvc-ui
to 2.1.0, and you can remove the related configuration about swagger-ui
dependency from the pom. Hope this helps.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论