Swagger实战教程第三集:Spring Boot 中快速集成Swagger 2.9.2

Spring  Boot 中快速集成Swagger 2.9.2

@长春叭哥 2018年9月29日星期六

视频教程免费观看地址:

https://www.iqiyi.com/playlist525697702.html 

参阅资料:

Documenting Spring Boot REST API with Swagger and SpringFox

https://www.vojtechruzicka.com/documenting-spring-boot-rest-api-swagger-springfox/

JeeSite4.0入门教程 JeeSite4.0入门教程

https://edu.csdn.net/course/detail/9316

Adding Depende+ncies

<dependency>

    <groupId>io.springfoxgroupId>

    <artifactId>springfox-swagger2artifactId>

    <version>2.9.2version>

dependency>

Basic configuration

@Configuration
@EnableSwagger2
public class SpringFoxConfig {
    @Bean
    public Docket apiDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }
}

 

验证api-docs

http://localhost:8980/js/v2/api-docs

 

Adding UI

<dependency>
    <groupId>io.springfoxgroupId>
    <artifactId>springfox-swagger-uiartifactId>
    <version>2.9.2version>
dependency>

验证URL

http://localhost:8980/js/swagger-ui.html

 

精简版Demo

 

 

 

http://localhost:8080/swagger-ui.html

SwaggerHub同步演示

http://localhost:8080/v2/api-docs

你可能感兴趣的:(swagger实战教程)