swagger 추가
This commit is contained in:
@@ -59,4 +59,7 @@ Hibernate: alter table api_service_key add constraint UKqntc9y3urphwjcwp4a0rcxx3
|
|||||||
|
|
||||||
3. 다음 url 로 접속: http://localhost:38080
|
3. 다음 url 로 접속: http://localhost:38080
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
### SWAGGER 추가
|
||||||
|
* 접속 : http://localhost:48080/swagger-ui/
|
||||||
@@ -2,8 +2,13 @@ plugins {
|
|||||||
id 'org.springframework.boot' version '2.4.4'
|
id 'org.springframework.boot' version '2.4.4'
|
||||||
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
||||||
id 'java'
|
id 'java'
|
||||||
|
id 'war'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WAS, 톰캣에 배포 시 BOOT 실행 요소 제거 배포
|
||||||
|
bootWar.enabled = false
|
||||||
|
war.enabled = true
|
||||||
|
|
||||||
ext['logback.version'] = '1.2.10'
|
ext['logback.version'] = '1.2.10'
|
||||||
group = 'com.eactive'
|
group = 'com.eactive'
|
||||||
version = '1.0.1'
|
version = '1.0.1'
|
||||||
@@ -24,6 +29,8 @@ dependencies {
|
|||||||
// implementation 'com.github.darrachequesne:spring-data-jpa-datatables:5.1.0'
|
// implementation 'com.github.darrachequesne:spring-data-jpa-datatables:5.1.0'
|
||||||
// implementation 'com.google.jimfs:jimfs:1.2'
|
// implementation 'com.google.jimfs:jimfs:1.2'
|
||||||
|
|
||||||
|
implementation 'io.springfox:springfox-boot-starter:3.0.0'
|
||||||
|
|
||||||
implementation 'org.apache.commons:commons-lang3:3.10'
|
implementation 'org.apache.commons:commons-lang3:3.10'
|
||||||
implementation 'commons-io:commons-io:2.6'
|
implementation 'commons-io:commons-io:2.6'
|
||||||
implementation 'com.jayway.jsonpath:json-path:2.4.0'
|
implementation 'com.jayway.jsonpath:json-path:2.4.0'
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class ApiController {
|
|||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
//@RequestMapping(value = "/mock-api/**")
|
//@RequestMapping(value = "/mock-api/**")
|
||||||
@RequestMapping(value = "/{_:^(?!plugins|dist|favicon.ico).*$}/**")
|
@RequestMapping(value = "/{_:^(?!swagger-ui|plugins|dist|favicon.ico).*$}/**")
|
||||||
public ResponseEntity<String> mockApi(HttpEntity<String> httpEntity, HttpServletRequest request,
|
public ResponseEntity<String> mockApi(HttpEntity<String> httpEntity, HttpServletRequest request,
|
||||||
HttpServletResponse response) throws Exception {
|
HttpServletResponse response) throws Exception {
|
||||||
logger.info("==================================================");
|
logger.info("==================================================");
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.eactive.httpmockserver.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import springfox.documentation.builders.ApiInfoBuilder;
|
||||||
|
import springfox.documentation.builders.PathSelectors;
|
||||||
|
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||||
|
import springfox.documentation.service.ApiInfo;
|
||||||
|
import springfox.documentation.spi.DocumentationType;
|
||||||
|
import springfox.documentation.spring.web.plugins.Docket;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class SwaggerConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Docket api() {
|
||||||
|
return new Docket(DocumentationType.OAS_30)
|
||||||
|
.useDefaultResponseMessages(false)
|
||||||
|
.select()
|
||||||
|
.apis(RequestHandlerSelectors.any())
|
||||||
|
.paths(PathSelectors.any())
|
||||||
|
.build()
|
||||||
|
.apiInfo(apiInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApiInfo apiInfo() {
|
||||||
|
return new ApiInfoBuilder()
|
||||||
|
.title("HttpMock Swagger")
|
||||||
|
.description("practice swagger config")
|
||||||
|
.version("1.0")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user