I'm trying to implement Swagger on a Java application that has two Application classes due to the fact that one deals with "public" web services and the other deals with "admin" web services. I'm trying to generate two separate swagger.json files, one for each Application class. However, only one of them is being generated for both urls. Here's some code:
Public Application class:
@WebServlet
@ApplicationPath("/public")
public class PublicApplication extends Application {
public PublicApplication() {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0");
beanConfig.setTitle("A Fine Title");
beanConfig.setDescription("A Fine Description.");
beanConfig.setSchemes(new String[]{"http"});
beanConfig.setBasePath("/api");
beanConfig.setResourcePackage("com.test.rest.resource.external");
beanConfig.setPrettyPrint(true);
beanConfig.setScan(true);
}
}
Private Application class:
@WebServlet
@ApplicationPath("/admin")
public class AdminApplication extends Application {
public AdminApplication() {
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0");
beanConfig.setTitle("Another Fine Title");
beanConfig.setDescription("Another Fine Description.");
beanConfig.setSchemes(new String[]{"http"});
beanConfig.setBasePath("/apiTwo");
beanConfig.setResourcePackage("com.test.rest.resource.internal");
beanConfig.setPrettyPrint(true);
beanConfig.setScan(true);
}
}
Now if I hit either of these urls I get the same "public" swagger json file:
What am I doing wrong?
Thanks to all who read!