I try to modify server list (or default server) on Swagger UI. 1/ On Spring (Not Spring Boot) configuration class I add this :
@Bean
public OpenAPI customOpenAPI() {
log.info("<<<customOpenAPI>>>");
Server server = new Server();
server.setUrl("http://localhost:8091/eatery_spring_rs/rs/");
return new OpenAPI()
.servers(List.of(server));
}
2/ But I never obtain result on Swagger UI, no server is added :
3/ Maven dependencies are :
<!--SWAGGER-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-ui -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.7</version>
</dependency>
<!-- END -->
5/ Question : Is it possible to change context path, or add server URL, by program ?
6/ I can affine the description of problem The context path of application is not complete
It is a Spring 5.3 application, start with web.xml in App Server.
like Tomcat, ...
This is the web.xml definition :
`
This mean that the real context path is : [app.context]/rs but in the case of :
@Bean public Docket api(ServletContext servletContext) {
servletContext is equal to [app.context] NOT to [app.context]/rs
It's help ?