http://localhost:8080/api/swagger-ui.html访问 页面报错:
Whitelabel Error PageThis application has no explicit mapping for /error, so you are seeing this as a fallback.Sun Nov 06 17:04:28 GMT+08:00 2016
There was an unexpected error (type=Not Found, status=404).
No message available
配置如下:
pom:<!-- 引入swagger2 -->
    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger2</artifactId>
      <version>2.4.0</version>
    </dependency>
    <dependency>
      <groupId>io.springfox</groupId>
      <artifactId>springfox-swagger-ui</artifactId>
      <version>2.4.0</version>
    </dependency>@Configuration
@EnableSwagger2
public class SwaggerConfiguration {    private final Logger log = LoggerFactory.getLogger(SwaggerConfiguration.class);    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }
}

解决方案 »

  1.   

    把SwaggerConfiguration里
      

  2.   

    把SwaggerConfiguration里创建Docket的代码放到Application.java
    然后加 @ComponentScan({"com.isoftstone.cityinsight.cidev.web.controller"})
      

  3.   

    web.xml加上:
    <mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/>  
    <mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>访问地址为:
     * http://IP:port/{context-path}/swagger-ui.html  
     * eg:http://localhost:8080/jd-config-web/swagger-ui.html