初始代码
This commit is contained in:
@@ -43,14 +43,18 @@ public class WebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||
*/
|
||||
@Bean
|
||||
public Docket docket() {
|
||||
log.info("准备生成接口文档...");
|
||||
ApiInfo apiInfo = new ApiInfoBuilder()
|
||||
.title("苍穹外卖项目接口文档")
|
||||
.version("2.0")
|
||||
.description("苍穹外卖项目接口文档")
|
||||
.build();
|
||||
//指定版本
|
||||
Docket docket = new Docket(DocumentationType.SWAGGER_2)
|
||||
//上文设置的信息
|
||||
.apiInfo(apiInfo)
|
||||
.select()
|
||||
//指定生成接口需要扫描的包
|
||||
.apis(RequestHandlerSelectors.basePackage("com.sky.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
@@ -62,6 +66,7 @@ public class WebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||
* @param registry
|
||||
*/
|
||||
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
log.info("开始设置静态资源映射...");
|
||||
registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user