1.导入依赖:
<!--swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
application.yml:
spring:
mvc:
pathmatch:
matching-strategy: ant_path_matcher
新建一个配置类,代码如下:
@Configuration
@EnableSwagger2
public class Swagger2Config {
@Bean
public Docket docket() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo());
}
/**
* 配置基本信息
*
* @return
*/
@Bean
public ApiInfo apiInfo() {
Contact contact = new Contact("aa", "http://localhost:8061/backend/page/login/login.html", "2643546369@qq.com");
return new ApiInfo("*****管理系统接口文档",
"*****管理系统接口文档",
" v1.0",
" http://localhost:8061/*****/login.html",
contact, "Apache 2.0", "http://localhost:8061/*****/login.html",
new ArrayList());
}
}