I have a swagger.yaml file containing definition of my API. I'm using the following piece of code to add it as a swagger resource and display it in swagger-ui:
@Primary
@Bean
public SwaggerResourcesProvider swaggerResourcesProvider(InMemorySwaggerResourcesProvider defaultResourcesProvider) {
return () -> {
SwaggerResource wsResource = new SwaggerResource();
wsResource.setName("Documentation");
wsResource.setSwaggerVersion("3.0");
wsResource.setLocation("/swagger.yaml");
List<SwaggerResource> resources = new ArrayList<>(defaultResourcesProvider.get());
resources.add(wsResource);
return resources;
};
}
However, I need to have a different security schema authorization URL for each instance of my application (dev, test, prod). The question is how to achieve it? Is it possible to programmatically add the security schema, which will be parametrized based on f.e. env variables?