Repository navigation
How to override the transitive Swagger UI WebJar version in Springdoc 3.2.0? #3401
|
Hello everyone! I’m using Springdoc OpenAPI 3.2.0 with Spring Boot 4.1.2 and Maven. Springdoc 3.2.0 currently resolves the following transitive dependency:
I’d like to use a newer Swagger UI WebJar version (5.34.1) while keeping Springdoc 3.2.0. I tried overriding the transitive dependency through Maven’s dependencyManagement: org.webjars swagger-ui 5.34.1Maven resolves the requested version correctly. However, after applying this override, Swagger UI resources start returning HTTP 404 in the application. Removing the override restores Swagger UI functionality. I also checked the Springdoc 3.2.0 POM and noticed that the Swagger UI version is centrally managed through the swagger-ui.version property. My questions are:
I’d appreciate any guidance or recommendations from the maintainers or the community. Thank you! |
Replies: 1 comment 1 reply
|
Overriding the WebJar in Maven is not enough. You also need to set Springdoc does not look up the WebJar version at runtime. It reads the version from its own config and builds the resource location from it, That version comes from That file is filled in at build time from the With your override, the classpath only has The fix is to set the property so both agree: springdoc.swagger-ui.version=5.34.1On your three questions:
(I looked this up in the code with help from an AI assistant; the links are to the lines I checked.) |
Overriding the WebJar in Maven is not enough. You also need to set
springdoc.swagger-ui.version=5.34.1in your application config (application.properties or application.yml).Springdoc does not look up the WebJar version at runtime. It reads the version from its own config and builds the resource location from it,
META-INF/resources/webjars/swagger-ui/<version>/:springdoc-openapi/springdoc-openapi-starter-common/src/main/java/org/springdoc/ui/AbstractSwaggerConfigurer.java
Lines 62 to 63 in 3316c45