我正在尝试添加有关API的自定义信息。我添加了自定义信息,但它不起作用。我收到旧信息。任何人都可以告诉我为什么我没有收到自定义信息? http://localhost:8086/swagger-ui.html
在这里,我添加了我的依赖和swagger配置文件
依赖
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
<scope>compile</scope>
</dependency>
SwaggerConfig.java
package com.spacestudy.config;
import static springfox.documentation.builders.PathSelectors.regex;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(metaData())
.select()
.apis(RequestHandlerSelectors.basePackage("com.spacestudy.controller"))
.paths(regex("/api.spacestudy.com"))
.build();
}
private ApiInfo metaData() {
Contact contact = new Contact("XYZ", "XYZ.com", XYZ@gmail.com);
return new ApiInfoBuilder()
.title("Spring Boot REST API")
.description("Spring Boot REST API for Space Study")
.version("1.0.0")
.license("Apache 2.0")
.contact(contact)
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0")
.build();
}
}