swagger3.0和2.x的版本有一些配置是不一样的,故记录下。
pom.xml依赖
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
Config.java内容
@Configuration
@EnableSwagger2
public class SwaggerConfig {
public Docket swaggerRestApi() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(new ApiInfoBuilder()
.title("Swagger数据库操作接口").description("api接口文档").version("1.0.0").build())
.select().paths(PathSelectors.any()).build();
}
}
页面访问
http://ip:port/swagger-ui/index.html
- SpringBoot Swagger3 Swaggerspringboot2 springboot swagger3 swagger springboot swagger3 swagger springboot swagger3权限swagger springboot swagger3 knife4j swagger swagger3 注解swagger3常用swagger swagger swagger2 swagger3 amp modelconverter swagger3 openapi3对象 springboot swagger springboot swagger2 swagger