diff --git a/restful-web-service/pom.xml b/restful-web-service/pom.xml
index e1a3ab89..3c3cbbd6 100644
--- a/restful-web-service/pom.xml
+++ b/restful-web-service/pom.xml
@@ -81,6 +81,18 @@
springfox-boot-starter
3.0.0
+
+ io.springfox
+ springfox-swagger-ui
+ 3.0.0
+
+
+
+
+
+
+
+
diff --git a/restful-web-service/src/main/java/com/example/restfulwebservice/config/SwaggerConfig.java b/restful-web-service/src/main/java/com/example/restfulwebservice/config/SwaggerConfig.java
index 5f14f7e7..c3053849 100644
--- a/restful-web-service/src/main/java/com/example/restfulwebservice/config/SwaggerConfig.java
+++ b/restful-web-service/src/main/java/com/example/restfulwebservice/config/SwaggerConfig.java
@@ -2,6 +2,10 @@ package com.example.restfulwebservice.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
@@ -16,19 +20,35 @@ import java.util.Set;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
- private static final Contact DEFAULT_CONTACT = new Contact("Kim",
- "http://www.joneconsulting.co.kr", "email@naver.com");
- private static final ApiInfo DEFAULT_API_INFO = new ApiInfo("Awesome Api Title",
- "My User management REST API service", "1.0", "uri:tos",
- DEFAULT_CONTACT, "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList<>());
- private static final Set DEFAULT_PRODUCES_AND_CONSUMES = new HashSet<>(
- Arrays.asList("application/json", "application/xml"));
+// private static final Contact DEFAULT_CONTACT = new Contact("Kim",
+// "http://www.joneconsulting.co.kr", "email@naver.com");
+// private static final ApiInfo DEFAULT_API_INFO = new ApiInfo("Awesome Api Title",
+// "My User management REST API service", "1.0", "uri:tos",
+// DEFAULT_CONTACT, "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList<>());
+// private static final Set DEFAULT_PRODUCES_AND_CONSUMES = new HashSet<>(
+// Arrays.asList("application/json", "application/xml"));
+// @Bean
+// public Docket api() {
+// return new Docket(DocumentationType.SWAGGER_2)
+// .apiInfo(DEFAULT_API_INFO)
+// .produces(DEFAULT_PRODUCES_AND_CONSUMES)
+// .consumes(DEFAULT_PRODUCES_AND_CONSUMES);
+// }
+
+// @Bean
+// public Docket apiDocket() {
+// return new Docket(DocumentationType.SWAGGER_2)
+// .select()
+// .apis(RequestHandlerSelectors.any())
+// .paths(PathSelectors.any())
+// .build();
+// }
@Bean
- public Docket api() {
- return new Docket(DocumentationType.SWAGGER_2)
- .apiInfo(DEFAULT_API_INFO)
- .produces(DEFAULT_PRODUCES_AND_CONSUMES)
- .consumes(DEFAULT_PRODUCES_AND_CONSUMES);
+ public Docket produceApi() {
+ return new Docket(DocumentationType.SWAGGER_2).select()
+ .apis(RequestHandlerSelectors.basePackage("com.example.restfulwebservice"))
+ .build();
}
+
}
diff --git a/restful-web-service/src/main/java/com/example/restfulwebservice/user/UserJpaController.java b/restful-web-service/src/main/java/com/example/restfulwebservice/user/UserJpaController.java
index 48d8813e..e7822332 100644
--- a/restful-web-service/src/main/java/com/example/restfulwebservice/user/UserJpaController.java
+++ b/restful-web-service/src/main/java/com/example/restfulwebservice/user/UserJpaController.java
@@ -78,7 +78,7 @@ public class UserJpaController {
post.setUser(user.get());
Post savedPost = postRepository.save(post);
- URI location = ServletUriComponentsBuilder. ()
+ URI location = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}")
.buildAndExpand(savedPost.getId())
.toUri();
diff --git a/restful-web-service/src/main/resources/application.yml b/restful-web-service/src/main/resources/application.yml
index cbbfe72b..af69f3bb 100644
--- a/restful-web-service/src/main/resources/application.yml
+++ b/restful-web-service/src/main/resources/application.yml
@@ -3,7 +3,7 @@ server:
logging:
level:
- org.springframework: DEBUG
+ org.springframework: INFO
spring:
messages:
@@ -25,7 +25,6 @@ spring:
username: sa
password:
-
management:
endpoints:
web: