'How to read multiple json files using java config instead of property in SpringDoc/OpenApi?

This issue is already resolved in swaggerfox below code snippet -

@Primary
@Bean
public SwaggerResourcesProvider swaggerResourcesProvider(InMemorySwaggerResourcesProvider defaultResourcesProvider) {
    return () -> {
        List<SwaggerResource> resources = new ArrayList<>();
        SwaggerResource wsResource = new SwaggerResource();
        wsResource.setName("TPS");
        wsResource.setSwaggerVersion("2.0");
        wsResource.setLocation("/swagger.json");           
        
        resources.add(resource);
        resources.add(notificationResource);
        return resources;
    };
}

========================================

We will need replace this code in springdoc/openapi? We have below property field -

springdoc.swagger-ui.urls[0].url=/swaggerdoc/openapi.json

springdoc.swagger-ui.urls[0].name=openapi

But instate of property driven we need the custom implementation and need implementation in spring-boot configuration?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source