Hi all. So we have been running into this issue of not seeing our documentation and endpoints being properly captured in our Spring MVC webservice application. It's empty UI returned. The implementation worked just fine in our other Spring Boot projects but not in our MVC project.
Our configuration setup is produced below. We have tried multiple setups and configurations including the sample from your github repository. Any assistance or advice would greatly be appreciated! And I apologize in advance if this is not the right place to post this! We've posted this on Stack Overflow a couple of days ago but no answer yet. Link : https://stackoverflow.com/questions/44731854/springfox-swagger-configuration-and-documentation-not-being-captured UserDeviceAuthenticationController @RestControllerpublic class UserDeviceAuthenticationController { private static final Logger LOGGER = Logger .getLogger(UserDeviceAuthenticationController.class); /** * * @param response * @param request * @param deviceID: a misnomer. This field is different for every client set up on Fitbit * @throws IOException * @throws ParseException */@RequestMapping(value = "/fitbitEndPoint", method = RequestMethod.POST)public void fitbitEndPoint(HttpServletResponse response, //Body logic redacted } PHDDeviceRestService @Path("device/v2.0")@Componentpublic class PHDDeviceRestService extends BaseServiceImpl { @POST @Path("/{deviceId}/url") @Produces({ MediaType.APPLICATION_JSON }) @Consumes({ MediaType.APPLICATION_JSON }) public Response getDeviceURL(GetDeviceURLRequest getDeviceURLRequest, @PathParam("deviceId") Long deviceId) throws PHDWebServiceException { //Logic redacted } Our relevant Swagger Springfox Dependencies in our Pom.xml <!-- Swagger dependency --> <dependencies> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.6.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.6.0</version> </dependency> </dependencies> Our web.xml containing the servlets and url patterns: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns= "http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <servlet> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet- class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/mvc/webmvc-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <!-- Map all *.spring requests to the DispatcherServlet for handling --> <servlet-mapping> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <url-pattern>/devices/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <url-pattern>/healthyweight/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <url-pattern>/DevicesGateway/*</url-pattern> </servlet-mapping> <servlet> <servlet-name>jersey</servlet-name> <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.uhg.phd.rest;com.uhg.phd.rest.MongoDB</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>CXFSevlet</servlet-name> <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>CXFSevlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>CXFSevlet</servlet-name> <url-pattern>/ws/*</url-pattern> </servlet-mapping> <!-- <servlet-mapping> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> --> <servlet-mapping> <servlet-name>CXFSevlet</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> <!-- <servlet-mapping> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <url-pattern>/swagger-ui.html</url-pattern> </servlet-mapping> --> </web-app> Our SwaggerConfig class where Docket Bean is defined : @EnableSwagger2public class SwaggerConfig { @Beanpublic Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build();} } Our WebMvcConfig class with ViewControllers and ResourceHandlers : @EnableWebMvc public class WebMvcConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/documentation/v2/api-docs", "/v2/api-docs?group=restful-api"); registry.addRedirectViewController( "/documentation/swagger-resources/configuration/ui", "/swagger-resources/configuration/ui"); registry.addRedirectViewController( "/documentation/swagger-resources/configuration/security", "/swagger-resources/configuration/security"); registry. addRedirectViewController("/documentation/swagger-resources", "/swagger-resources"); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("documentation/swagger-ui.html") . addResourceLocations("classpath:/META-INF/resources/"); registry. addResourceHandler("documentation/webjars/**") .addResourceLocations( "classpath:/META-INF/resources/webjars/"); } } -- You received this message because you are subscribed to the Google Groups "Swagger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
