Reputation: 3715
I have a spring application whose web.xml looks like below:
<servlet>
<servlet-name>app</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/app-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>app</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
Inside my app-servlet.xml
I have the below config entry:
<context:component-scan base-package="com.rest.apidoc" />
I have my SwaggerConfig
inside the com.rest.apidoc
directory
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
}
Now when I try to run the app http://domain:port/app/service/api-docs
, I get the error on my console No mapping found for HTTP request with URI [/app/service/api-docs] in DispatcherServlet with name 'app'
Where am I going wrong?
Upvotes: 0
Views: 458
Reputation: 4430
There is few things that may go wrong:
Refer to the following project to check whether you've configured your application correctly: Spring Security for REST Example Project
Upvotes: 1