springboot中swarger的使用

1、加入依赖


    com.spring4all
    swagger-spring-boot-starter
    1.8.0.RELEASE

2、在启动类上写注解

@SpringBootApplication
@EnableSwagger2Doc
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

3、在application.properties配置文件中写扫描包就搞定了

swagger.base-package=com.yh.controller

4、配置swarger成功后的访问地址就可以使用了:
http://localhost:8080/swagger-ui.html

在maven项目中配置swarger的话,推荐大哥们看下intboy大大的博客,写的很好
https://blog.csdn.net/fengspg/article/details/43705537

你可能感兴趣的:(springboot中swarger的使用)