今天写接口,照着网上教程写了,SpringMVC+Swagger2 发现能出现swagger-ui.html页面,但是无法显示接口方法。
原来没有加扫描包注解@ComponentScan
参考:https://www.jianshu.com/p/c4aa20052116
放上代码:
package com.charbel.api;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
impor