首页 > 编程语言 > 详细

【Swagger】-SpringBoot中集成Swagger使用

时间:2021-07-23 23:37:35      阅读:28      评论:0      收藏:0      [点我收藏+]

1、新建SpringBoot-Web项目

2、导入Swagger的maven依赖

        <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>3.0.0</version>
        </dependency>

3、编写HelloWorld测试

4、配置SwaggerConfiger,下一个如下的配置文件

package com.gsl.swagger.config;

import org.springframework.context.annotation.Configuration;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    
}

5、测试运行,访问:http://localhost:8080/swagger-ui/index.html

【Swagger】-SpringBoot中集成Swagger使用

原文:https://www.cnblogs.com/gslgb/p/15050097.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!