0
有沒有人知道如何在Spring引導和Swagger 2.0中自定義tom級別的屬性?如何在Spring引導和Swagger 2.0中自定義tom級別的屬性?
我試過使用@SwaggerDefinition,但這似乎不起作用。我的代碼中是否有任何錯誤?
@SpringBootApplication
@ComponentScan(basePackages = { "test" })
@EnableSwagger2
@SwaggerDefinition(info = @Info(title = "My Api Documentation",
description = "My Api Documentation, Version:1.0",
version = "1.0",
contact = @Contact(name = "my name", email = "[email protected]", url = "http://my_page/") ,
license = @License(name = "Apache 2.0", url = "http://www.apache.org/licenses/LICENSE-2.0")))
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
和我從http://localhost:8080/v2/api-docs
{
swagger: "2.0",
info: {
description: "Api Documentation",
version: "1.0",
title: "Api Documentation",
termsOfService: "urn:tos",
contact: {
name: "Contact Email"
},
license: {
name: "Apache 2.0",
url: "http://www.apache.org/licenses/LICENSE-2.0"
}
},
host: "localhost:8080",
basePath: "/",
tags: [
{
name: "basic-error-controller",
description: "Basic Error Controller"
}
],
...
}
的頂級屬性(標題,詳細描述)下面JSON響應都應該已經改變。
改進了語法,使問題更具可讀性。 – missimer
非常感謝,我會盡我所能。 –