diff --git a/build.gradle b/build.gradle index 2889724..8fc632d 100644 --- a/build.gradle +++ b/build.gradle @@ -20,11 +20,15 @@ repositories { dependencies { //implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0' - implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' - implementation 'org.springframework.boot:spring-boot-starter-data-jdbc' - implementation 'org.springframework.boot:spring-boot-starter-jdbc' - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'mysql:mysql-connector-java' + implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:2.6.0' + implementation 'org.springframework.boot:spring-boot-starter-data-jdbc:2.6.0' + implementation 'org.springframework.boot:spring-boot-starter-jdbc:2.6.0' + implementation 'org.springframework.boot:spring-boot-starter-web:2.6.0' + implementation 'io.springfox:springfox-swagger2:2.8.0' + implementation 'io.springfox:springfox-swagger-ui:2.8.0' + implementation 'io.springfox:springfox-core:2.8.0' + implementation 'javax.xml.bind:jaxb-api' + implementation 'mysql:mysql-connector-java:8.0.27' implementation 'com.auth0:java-jwt:3.8.2' implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0' //implementation 'com.google.code.gson:gson:2.7' diff --git a/src/main/java/org/microvolunteer/platform/config/SwaggerConfiguration.java b/src/main/java/org/microvolunteer/platform/config/SwaggerConfiguration.java new file mode 100644 index 0000000..e26b16a --- /dev/null +++ b/src/main/java/org/microvolunteer/platform/config/SwaggerConfiguration.java @@ -0,0 +1,34 @@ +package org.microvolunteer.platform.config; + +import com.google.common.base.Predicate; +import com.google.common.base.Predicates; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class SwaggerConfiguration { + @Bean + public Docket swaggerSpringMvcPlugin() { + return new Docket(DocumentationType.SWAGGER_2) + .groupName("micro-volunteer-api") // APIドキュメントをグルーピングするための識別名 + .select() + .paths(paths()) + .build() + .apiInfo(apiInfo()); + } + + private Predicate paths() { + return Predicates.or(Predicates.containsPattern("/v1/api*")); + } + + private ApiInfo apiInfo() { + ApiInfo apiInfo = new ApiInfo("micro-volunteer API", "micro-volunteer platformを利用するためのAPIです。", + "v1", "", "http://micro-volunteer-supporter.com", "", ""); + return apiInfo; + } +} diff --git a/src/main/java/org/microvolunteer/platform/controller/Controller.java b/src/main/java/org/microvolunteer/platform/controller/Controller.java index e3d36b8..bf25bd8 100644 --- a/src/main/java/org/microvolunteer/platform/controller/Controller.java +++ b/src/main/java/org/microvolunteer/platform/controller/Controller.java @@ -15,7 +15,7 @@ @RestController -@RequestMapping("/v1") +@RequestMapping("/v1/api") @Slf4j public class Controller { private Logger logger = LoggerFactory.getLogger(Controller.class);