您的位置:首页 > 其它

SSM配置swagger

2018-02-04 17:28 309 查看
1、springmvc文件里添加配置

<!--添加swagger配置-->
<beanclass="springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration"id="swagger2Config"/>
<mvc:resourceslocation="classpath:/META-INF/resources/"mapping="swagger-ui.html"/>
<mvc:resourceslocation="classpath:/META-INF/resources/webjars/"mapping="/webjars/**"/>
2、web.pom中添加依赖
!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.5.0</version>
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.5.0</version>
</dependency>

3、访问地址为

     http://服务地址:端口/工程名/swagger-ui.html
下图为idea中web配置,启动项目可直接访问swagger

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: