1
|
package eu.dnetlib.repo.manager.service.config;
|
2
|
|
3
|
import eu.dnetlib.repo.manager.service.controllers.MonitorApi;
|
4
|
import eu.dnetlib.repo.manager.service.controllers.PiWikApi;
|
5
|
import eu.dnetlib.repo.manager.service.controllers.RepositoryApi;
|
6
|
import eu.dnetlib.repo.manager.service.controllers.ValidatorApi;
|
7
|
import org.springframework.context.annotation.Bean;
|
8
|
import org.springframework.context.annotation.ComponentScan;
|
9
|
import org.springframework.context.annotation.Configuration;
|
10
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
11
|
import springfox.documentation.builders.PathSelectors;
|
12
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
13
|
import springfox.documentation.service.ApiInfo;
|
14
|
import springfox.documentation.service.Contact;
|
15
|
import springfox.documentation.service.VendorExtension;
|
16
|
import springfox.documentation.spi.DocumentationType;
|
17
|
import springfox.documentation.spring.web.plugins.Docket;
|
18
|
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
19
|
import java.util.ArrayList;
|
20
|
|
21
|
|
22
|
/**
|
23
|
* Created by panagiotis on 16/11/2017.
|
24
|
*/
|
25
|
@Configuration
|
26
|
@EnableSwagger2
|
27
|
@EnableWebMvc
|
28
|
@ComponentScan(basePackageClasses = {
|
29
|
RepositoryApi.class,
|
30
|
MonitorApi.class,
|
31
|
ValidatorApi.class,
|
32
|
PiWikApi.class
|
33
|
})
|
34
|
public class SwaggerConfig {
|
35
|
|
36
|
@Bean
|
37
|
public Docket productApi() {
|
38
|
return new Docket(DocumentationType.SWAGGER_2)
|
39
|
.select()
|
40
|
.apis(RequestHandlerSelectors.any())
|
41
|
.paths(PathSelectors.any())
|
42
|
.build()
|
43
|
.pathMapping("/")
|
44
|
.apiInfo(getApiInfo());
|
45
|
}
|
46
|
|
47
|
private ApiInfo getApiInfo() {
|
48
|
return new ApiInfo("Repository Manager Dashboard API Documentation",
|
49
|
"Repository Manager Dashboard API Documentation",
|
50
|
"1.0",
|
51
|
"urn:tos",
|
52
|
new Contact("", "", ""),
|
53
|
"Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0",
|
54
|
new ArrayList<VendorExtension>());
|
55
|
}
|
56
|
|
57
|
}
|