build: 설정 정리

dev
Lim Jonguk 3 years ago
parent 5e8e150066
commit 461dfd43f1

@ -7,7 +7,7 @@
buildscript { buildscript {
ext { ext {
springBootVersion ='2.6.1' springBootVersion ='2.6.3'
} }
dependencies { dependencies {
@ -20,7 +20,7 @@ buildscript {
plugins { plugins {
//id 'application' //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 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java' id 'java'
id 'war' id 'war'
@ -220,13 +220,12 @@ dependencies {
implementation 'com.googlecode.json-simple:json-simple:1.1.1' implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'com.google.code.gson:gson:2.8.9' implementation 'com.google.code.gson:gson:2.8.9'
// jackson
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.1'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.1'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.1' 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.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-joda:2.13.1'
//implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5'
// response xml // response xml
implementation 'javax.xml.bind:jaxb-api:2.3.1' implementation 'javax.xml.bind:jaxb-api:2.3.1'
//implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5' //implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5'
@ -235,20 +234,8 @@ dependencies {
//-----------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------//
// Test // Test
//-----------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------//
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-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' testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok' testAnnotationProcessor 'org.projectlombok:lombok'

@ -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;
/**
* <pre>
* WebFilter
* Application main @ServletComponentScan annotation
* logging.level.org.springframework.web.filter=debug ( )
* --> ::
* logback CustomCommonsRequestLoggingFilter logger level=debug or info
* CommonsRequestLoggingFilter
* logging url
*
* LoggerAspect
* </pre>
*/
//@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;
// }
}

@ -49,16 +49,13 @@ decorator:
enable-logging: true enable-logging: true
logging: logging:
level: level:
# spring.mvc.log-request-details=debug 활성화
web: debug
root: info root: info
# hibernate sql log 출력시 변수 바인딩
org: org:
hibernate: hibernate:
# hibernate sql log 출력시 변수 바인딩
#type: trace #type: trace
springframework:
web:
#CommonsRequestLoggingFilter(RequestLoggingConfig) 를 이용한 로그출력을 위해 필수 debug
filter: error
# ================================================================================================================== # ==================================================================================================================
# Spring-doc 활성 # Spring-doc 활성
# ================================================================================================================== # ==================================================================================================================

@ -54,9 +54,11 @@ decorator:
enable-logging: true enable-logging: true
logging: logging:
level: level:
# spring.mvc.log-request-details=debug 활성화
web: debug
root: info root: info
org:
# hibernate sql log 출력시 변수 바인딩 # hibernate sql log 출력시 변수 바인딩
org:
#hibernate: #hibernate:
#type: trace #type: trace

@ -23,6 +23,10 @@ spring:
# DispatcherServlet의 log 활성화 # DispatcherServlet의 log 활성화
log-request-details: true log-request-details: true
log-resolved-exception: true log-resolved-exception: true
# DELETE OPTION method
hiddenmethod:
filter:
enabled: true
# JSP 등 템플릿 엔진 사용시 설정 # JSP 등 템플릿 엔진 사용시 설정
# static-path-pattern: /static/** # static-path-pattern: /static/**
# view: # view:

Loading…
Cancel
Save