# springMvc_Swagger
**Repository Path**: fengchao111/springMvc_Swagger
## Basic Information
- **Project Name**: springMvc_Swagger
- **Description**: springMvc整合Swagger的案例!
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2018-01-11
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# springMvc_Swagger
## 项目框架版本基本介绍:
spring4.2.6
swagger2.5.0
## Swagger的maven依赖
``` stylus
io.springfox
springfox-swagger2
${swagger2.version}
io.springfox
springfox-swagger-ui
${swagger2.version}
io.springfox
springfox-staticdocs
${swagger2.version}
```
**swagger的访问主页,查看springfox-swagger-ui包下的主页swagger-ui.html,所以访问的主页为:http:/id:port/projectName/swagger-ui.html**
### **问题1:遇到一个问题,项目中配置的springMvc请求是/,若配置的*.do,*.action请求是不是用不了swagger呢?**
项目中是maven的方式引用的ui插件springfox-swagger-ui,本人也确实查看过该springfox-swagger-ui包下的swagger-ui.html里面的请求就是/.两种思路:1.更改springfox-sqagger-ui的源码 2.使用开源的ui。显然,第二种方式比较合理。
项目中引入swagger-ui的过程:
1. 下载swagger-ui源码:https://github.com/swagger-api/swagger-ui
2. 拷贝dist下面的所以所有源文件,到webapp下的swagger文件夹下(创建swagger文件夹)
3. 修改swagger下的index.html的代码:
``` stylus
url: "http://localhost:8080/springMvc_Swagger/v2/api-docs.do?group=用户TEST",
```
访问项目swagger主页为:http://localhost:8080/springMvc_Swagger/swagger/index.html
**ps:此时可以不需要引入springfox-swagger-ui,url的请求后缀方式随着springmvc的请求后缀随着更改**