Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple swagger JSON's in swagger-ui.html #1954

dreambrother opened this issue Jul 28, 2017 · 2 comments


Copy link

commented Jul 28, 2017

Hello, I have a question. Looks like springfox doesn't automatically document spring-ws endpoints (websocket). I didn't find any solution how to document it manually, so I decided to write Swagger JSON doc manually, serve it as a static content and add it to Springfox's swagger-ui.html page. I was able to do this by adding another tag directly in a browser image
Now I want to add it in the application the code. Could you tell me how to do this? Or how to add endpoints to existing generated documentation manually?

Thanks :)

@dreambrother dreambrother changed the title Multiple swagger JSON's in Swagger UI Multiple swagger JSON's in swagger-ui.html Jul 28, 2017


This comment has been minimized.

Copy link

commented Jul 30, 2017

You need to create a bean that implements the SwaggerResourcesProvider interface. You'd have to make a composite bean that uses the and adds your own json file to it as well. Keep in mind you need to make this new bean a @Primary bean.


This comment has been minimized.

Copy link

commented Jul 31, 2017

This works! Thank you!

public class SwaggerWsEndpointsConfig {

    public SwaggerResourcesProvider swaggerResourcesProvider(InMemorySwaggerResourcesProvider defaultResourcesProvider) {
        return () -> {
            SwaggerResource wsResource = new SwaggerResource();
            wsResource.setName("ws endpoints");

            List<SwaggerResource> resources = new ArrayList<>(defaultResourcesProvider.get());
            return resources;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.