答案 0 :(得分:4)
您可以通过将ApiInfo对象传递到您的文档来设置这些值。
new Docket(DocumentationType.SWAGGER_2)
...
.apiInfo(new ApiInfo(...))
...
ApiInfo的构造函数接受有关API的若干详细信息。在这种情况下,您应该查看标题,说明和许可证参数。
答案 1 :(得分:0)
Swagger 配置类(Spring 启动):
@Configuration
public class SpringFoxConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build();
}
ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Demo Test API")
.description("Demo test API task")
.license("© 2021 by my")
.build();
}
}