Swagger Springfox for SpringMVC not working
<p>I'm using springfox to automatically generate swagger json. Currently I'm using springframework 4.2.2. Here is simple stuff i've configed.</p>

<h2>gradle</h2>

<pre><code>repositories {
    jcenter()
}
dependencies {
    compile "io.springfox:springfox-swagger2:2.3.0"
}
</code></pre>

<h2>SwaggerConfig.java</h2>

<pre><code>import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket api(){
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        ApiInfo apiInfo = new ApiInfo(
                "my api",
                "description",
                "version",
                "terms of service",
                "contact",
                "API License",
                "API License URL"
        );
        return apiInfo;
    }
}
</code></pre>

<p>The problem is I don't see any api-docs in <code>localhost:8080/v2/api-docs</code>、<code>localhost:8080/{myapp}/v2/api-docs</code>, what am I doing wrong here?</p>

<h2>Edited:</h2>

<p>Here is my web.xml and applicationContext.xml and rest-servlet.xml if needed.</p>

<p>Web.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1"&gt;

    &lt;display-name&gt;api&lt;/display-name&gt;

    &lt;listener&gt;
        &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt;
    &lt;/listener&gt;

    &lt;servlet&gt;
        &lt;servlet-name&gt;rest&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt;
        &lt;load-on-startup&gt;2&lt;/load-on-startup&gt;
    &lt;/servlet&gt;

    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;rest&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/v1/*&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;

    &lt;context-param&gt;
        &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt;
        &lt;param-value&gt;classpath:applicationContext.xml&lt;/param-value&gt;
    &lt;/context-param&gt;

    &lt;context-param&gt;
        &lt;param-name&gt;log4jConfigLocation&lt;/param-name&gt;
        &lt;param-value&gt;classpath:log4j.properties&lt;/param-value&gt;
    &lt;/context-param&gt;

&lt;/web-app&gt;
</code></pre>

<p>applicationContext.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop" xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.1.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"
       default-lazy-init="true"&gt;

    &lt;context:annotation-config/&gt;

    &lt;context:component-scan base-package="com.lingxia.yueju"/&gt;

    &lt;aop:aspectj-autoproxy/&gt;

    &lt;mvc:annotation-driven&gt;
        &lt;mvc:argument-resolvers&gt;
            &lt;bean class="com.lingxia.yueju.spring.resolver.ParamArgumentResolver" /&gt;
            &lt;bean class="com.lingxia.yueju.spring.resolver.NullableArgumentResolver" /&gt;
            &lt;bean class="com.lingxia.yueju.spring.resolver.ValidArgumentResolver" /&gt;
        &lt;/mvc:argument-resolvers&gt;
    &lt;/mvc:annotation-driven&gt;

    &lt;bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
        &lt;property name="configLocation" value="classpath:hibernate.cfg.xml"/&gt;
    &lt;/bean&gt;

    &lt;bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
        &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
    &lt;/bean&gt;

    &lt;bean class="com.lingxia.yueju.spring.resolver.AllDomainExceptionResolver"/&gt;

    &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;

&lt;/beans&gt;
</code></pre>

<p>rest-servlet.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd"
       default-lazy-init="true"&gt;

    &lt;aop:aspectj-autoproxy/&gt;

    &lt;mvc:interceptors&gt;
        &lt;mvc:interceptor&gt;
            &lt;mvc:mapping path="/**"/&gt;
            &lt;bean class="com.lingxia.yueju.interceptor.IpBlackListInterceptor"/&gt;
        &lt;/mvc:interceptor&gt;
    &lt;/mvc:interceptors&gt;

&lt;/beans&gt; 
</code></pre>