diff --git a/build.gradle b/build.gradle index 6b865d2..b7b1ea1 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { ext { - springBootVersion ='2.6.1' + springBootVersion ='2.6.3' } dependencies { @@ -20,7 +20,7 @@ buildscript { plugins { //id 'application' - id 'org.springframework.boot' version '2.6.1' + id 'org.springframework.boot' version '2.6.3' id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'java' id 'war' @@ -220,13 +220,12 @@ dependencies { implementation 'com.googlecode.json-simple:json-simple:1.1.1' implementation 'com.google.code.gson:gson:2.8.9' - - implementation 'com.fasterxml.jackson.core:jackson-core:2.13.1' - implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.1' + // jackson implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.1' implementation 'com.fasterxml.jackson.module:jackson-module-afterburner:2.13.1' - implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.1' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.13.1' + //implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5' + // response xml implementation 'javax.xml.bind:jaxb-api:2.3.1' //implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5' @@ -235,20 +234,8 @@ dependencies { //-----------------------------------------------------------------------------------// // Test //-----------------------------------------------------------------------------------// + testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' - testImplementation ('org.springframework.boot:spring-boot-starter-test'){ - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - testImplementation("org.junit.vintage:junit-vintage-engine") { - exclude group: "org.hamcrest", module: "hamcrest-core" - } - testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2' //'junit:junit:4.13.2' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' //'junit:junit:4.13.2' - testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.2' //'junit:junit:4.13.2' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2' //'junit:junit:4.13.2' - testRuntimeOnly 'org.hamcrest:hamcrest-library:2.2' - testRuntimeOnly 'com.jayway.jsonpath:json-path:2.5.0' - implementation 'org.assertj:assertj-core:3.21.0' testCompileOnly 'org.projectlombok:lombok' testAnnotationProcessor 'org.projectlombok:lombok' diff --git a/src/main/java/com/xit/core/config/filter/log/CustomCommonsRequestLoggingFilter.java b/src/main/java/com/xit/core/config/filter/log/CustomCommonsRequestLoggingFilter.java deleted file mode 100644 index 5f72db6..0000000 --- a/src/main/java/com/xit/core/config/filter/log/CustomCommonsRequestLoggingFilter.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.xit.core.config.filter.log; - -import com.xit.core.constant.XitConstants; -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.web.filter.CommonsRequestLoggingFilter; -import org.springframework.web.util.ContentCachingRequestWrapper; - -import javax.servlet.ServletInputStream; -import javax.servlet.annotation.WebFilter; -import javax.servlet.http.HttpServletRequest; -import java.io.IOException; -import java.util.regex.Pattern; - -/** - *
- * WebFilter로 등록 - * Application main에 @ServletComponentScan annotation 필요 - * logging.level.org.springframework.web.filter=debug 로 설정(로그 출력) - * --> 설정 불필요 :: 적용이 안돼고 있음 - * logback에 CustomCommonsRequestLoggingFilter 에 대한 logger level=debug or info로 설정 해야만 로그 출력 - * CommonsRequestLoggingFilter 확장 - * logging에서 제외할 url 패턴 지정 - * - * LoggerAspect 에서 로그 출력 하여 미사용 - *- */ -//@WebFilter(urlPatterns = "/api/*") -//@Order(Ordered.HIGHEST_PRECEDENCE) -public class CustomCommonsRequestLoggingFilter extends CommonsRequestLoggingFilter { - private static final Pattern ONLY_LOGGING_PATTERN = Pattern.compile(XitConstants.EXCLUDE_LOGGING_URL_PATTERN); - CatchLocation catchLocation = CatchLocation.AFTER; - - MessageMaker messageMaker; - - enum CatchLocation { - ALL, BEFORE, AFTER - } - - @Override - protected boolean shouldNotFilter(HttpServletRequest request) { - //It can be either RequestURI(includes context path) - String loggingPattern = request.getRequestURI(); - //or ServletPath based on your requirement - //loggingPattern = request.getServletPath(); - - // If you want to log a particular endpoint then return true - // or if you don't want to log the endpoint then return false - return ONLY_LOGGING_PATTERN.matcher(loggingPattern).find(); - } - - @Override - protected boolean shouldLog(HttpServletRequest request) { - return logger.isInfoEnabled(); - } - - @Override - protected void beforeRequest(HttpServletRequest request, String message) { - if(catchLocation == CatchLocation.BEFORE || catchLocation == CatchLocation.ALL) { - logger.info(message); - } - } - - @Override - protected void afterRequest(HttpServletRequest request, String message) { - if(request instanceof ContentCachingRequestWrapper) { - try (ServletInputStream is = request.getInputStream()) { - if(is.available() >= 0) { - while(true) { - int read = is.read(new byte[8096]); - if (read < 8096) { - break; - } - } - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } - if(catchLocation == CatchLocation.AFTER || catchLocation == CatchLocation.ALL) { - logger.info(message); - } - } - - @Override - protected String createMessage(HttpServletRequest request, String prefix, String suffix) { -// if(!logger.isWarnEnabled()) return null; - if(this.messageMaker != null) { - return this.messageMaker.make(request, prefix, suffix); - } else { - return super.createMessage(request, prefix, suffix); - } - } - - public interface MessageMaker { - String make(HttpServletRequest request, String prefix, String suffix); - } - - -// public CatchLocation getCatchLocation() { -// return catchLocation; -// } -// -// public void setCatchLocation(CatchLocation catchLocation) { -// this.catchLocation = catchLocation; -// } -// -// public void setMessageMaker(MessageMaker messageMaker) { -// this.messageMaker = messageMaker; -// } -} \ No newline at end of file diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index 4482dfd..fe75f92 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -49,16 +49,13 @@ decorator: enable-logging: true logging: level: + # spring.mvc.log-request-details=debug 활성화 + web: debug root: info + # hibernate sql log 출력시 변수 바인딩 org: hibernate: - # hibernate sql log 출력시 변수 바인딩 #type: trace - springframework: - web: - #CommonsRequestLoggingFilter(RequestLoggingConfig) 를 이용한 로그출력을 위해 필수 debug - filter: error - # ================================================================================================================== # Spring-doc 활성 # ================================================================================================================== diff --git a/src/main/resources/config/application-local.yml b/src/main/resources/config/application-local.yml index 4073b4a..c60107d 100644 --- a/src/main/resources/config/application-local.yml +++ b/src/main/resources/config/application-local.yml @@ -54,9 +54,11 @@ decorator: enable-logging: true logging: level: + # spring.mvc.log-request-details=debug 활성화 + web: debug root: info + # hibernate sql log 출력시 변수 바인딩 org: - # hibernate sql log 출력시 변수 바인딩 #hibernate: #type: trace diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 8272b10..9e4b93e 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -7,7 +7,7 @@ spring: profiles: active: local include: oauth - main: + main: # bean name 중복 허용 - junit 사용시 true?? allow-bean-definition-overriding: true # 순환참조 제거 @@ -23,6 +23,10 @@ spring: # DispatcherServlet의 log 활성화 log-request-details: true log-resolved-exception: true + # DELETE OPTION method + hiddenmethod: + filter: + enabled: true # JSP 등 템플릿 엔진 사용시 설정 # static-path-pattern: /static/** # view: