Spring3.2.5.RELEASE+集成Swagger2(2.6.1)实测成功

<!-- 测试接口工具api -->
 <dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-core</artifactId>
  <version>${swagger.version}</version>
 </dependency>
 <dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-spi</artifactId>
  <version>${swagger.version}</version>
 </dependency>
 <dependency>
  <groupId>io.swagger</groupId>
  <artifactId>swagger-annotations</artifactId>
  <version>1.5.20</version>
 </dependency>
 <dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-swagger2</artifactId>
  <version>${swagger.version}</version>
 </dependency>
 <dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-swagger-ui</artifactId>
  <version>${swagger.version}</version>
 </dependency>
 <dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-spring-web</artifactId>
  <version>${swagger.version}</version>
 </dependency>
 <dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>18.0</version>
 </dependency>
 <dependency>
  <groupId>com.fasterxml</groupId>
  <artifactId>classmate</artifactId>
  <version>1.3.3</version>
 </dependency>
 <dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-schema</artifactId>
  <version>${swagger.version}</version>
 </dependency>
 <dependency>
  <groupId>io.springfox</groupId>
  <artifactId>springfox-swagger-common</artifactId>
  <version>${swagger.version}</version>
 </dependency>
 <dependency>
  <groupId>org.springframework.plugin</groupId>
  <artifactId>spring-plugin-core</artifactId>
  <version>1.2.0.RELEASE</version>
 </dependency>
 <dependency>
  <groupId>io.swagger</groupId>
  <artifactId>swagger-models</artifactId>
  <version>1.5.20</version>
 </dependency>
 <dependency>
  <groupId>org.springframework.plugin</groupId>
  <artifactId>spring-plugin-metadata</artifactId>
  <version>1.2.0.RELEASE</version>
 </dependency>
 <!-- end -->

 

修改web.xml中

 

<servlet-mapping>
   <servlet-name>cms</servlet-name>
   <url-pattern>/</url-pattern>
</servlet-mapping>

 

##spring-mvc.xml中添加配置

<!-- swagger静态资源访问配置 -->
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/" />
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/" />

 

##解决之前存在的html、js、jsp无法显示的问题,保证swagger和旧项目页面兼容打开
<mvc:default-servlet-handler/>

 


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值