Revision 48399
Added by Claudio Atzori almost 7 years ago
SwaggerDocumentationConfig.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.swagger.configuration; |
2 | 2 |
|
3 |
import eu.dnetlib.OpenaireExporterConfig; |
|
4 |
import eu.dnetlib.OpenaireExporterConfig.Swagger; |
|
3 | 5 |
import eu.dnetlib.common.rmi.DNetRestDocumentation; |
6 |
import org.springframework.beans.factory.annotation.Autowired; |
|
4 | 7 |
import org.springframework.beans.factory.annotation.Value; |
5 | 8 |
import org.springframework.context.annotation.Bean; |
6 | 9 |
import org.springframework.context.annotation.Configuration; |
... | ... | |
16 | 19 |
@EnableSwagger2 |
17 | 20 |
public class SwaggerDocumentationConfig { |
18 | 21 |
|
19 |
@Value("${api.rest.contact.name}") |
|
20 |
private String contactName; |
|
21 |
@Value("${api.rest.contact.url}") |
|
22 |
private String contactUrl; |
|
23 |
@Value("${api.rest.contact.email}") |
|
24 |
private String contactEmail; |
|
25 |
@Value("${api.rest.title}") |
|
26 |
private String title; |
|
27 |
@Value("${api.rest.description}") |
|
28 |
private String description; |
|
29 |
@Value("${api.rest.license}") |
|
30 |
private String license; |
|
31 |
@Value("${api.rest.license.url}") |
|
32 |
private String licenseUrl; |
|
22 |
@Autowired |
|
23 |
private OpenaireExporterConfig config; |
|
33 | 24 |
|
34 | 25 |
@Bean |
35 | 26 |
public Docket customImplementation() { |
... | ... | |
43 | 34 |
} |
44 | 35 |
|
45 | 36 |
private ApiInfo apiInfo() { |
37 |
final Swagger swag = config.getSwagger(); |
|
46 | 38 |
return new ApiInfoBuilder() |
47 |
.title(title)
|
|
48 |
.description(description)
|
|
49 |
.license(license)
|
|
50 |
.licenseUrl(licenseUrl)
|
|
39 |
.title(swag.getApiTitle())
|
|
40 |
.description(swag.getApiDescription())
|
|
41 |
.license(swag.getApiLicense())
|
|
42 |
.licenseUrl(swag.getApiLicenseUrl())
|
|
51 | 43 |
.termsOfServiceUrl("") |
52 | 44 |
.version("1.0.0") |
53 |
.contact(new Contact(contactName, contactUrl, contactEmail)) |
|
45 |
.contact(new Contact( |
|
46 |
swag.getApiContactName(), |
|
47 |
swag.getApiContactUrl(), |
|
48 |
swag.getApiContactEmail())) |
|
54 | 49 |
.build(); |
55 | 50 |
} |
56 | 51 |
|
Also available in: Unified diff
refactor of the application properties