标签:端口 use Servle sep resource scan packages 路径 selector
之前配置过springboot,相比ssm要简单很多,现在记录一下ssm的配置
<!--swagger本身不支持spring mvc的,springfox把swagger包装了一下,让他可以支持springmvc-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
@WebAppConfiguration
@EnableSwagger2
@EnableWebMvc
@ComponentScan(basePackages = "com.maxcore.controller")
public class SwaggerConfig {
@Bean
public Docket customDocket() {
//
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
Contact contact = new Contact("娜", "https://www.baidu.me", "baidu_666@icloud.com");
return new ApiInfo("仿简书前台API接口",//大标题 title
"Swagger测试demo",//小标题
"0.0.1",//版本
"www.baidu.com",//termsOfServiceUrl
contact,//作者
"Blog",//链接显示文字
"https://www.baidu.me"//网站链接
);
}
}
<bean class="com.maxcore.config.SwaggerConfig" />
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/" />
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/" />
笔者的本地的访问路径是 http://localhost/jianShuSSM_war/swagger-ui.html
一般都是
http://ip地址:端口(默认80,不显示)/项目名/swagger-ui.html
标签:端口 use Servle sep resource scan packages 路径 selector
原文地址:https://www.cnblogs.com/panbingwen/p/11067746.html