1、pom.xml导入包
<!--swagger-->
<dependency>
<groupId>com.didispace
<artifactId>spring-boot-starter-swagger
<version>1.1.0.RELEASE
</dependency>
2、WebMvcConfig配置
@Configuration
public class WebMvcConfigextends WebMvcConfigurationSupport {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
3、application 配置
开启swagger4、application.yml 配置
5、使用
网友评论