File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package com.takensoft.cms.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.egovframe.rte.fdl.cmmn.trace.LeaveaTrace;
import org.egovframe.rte.fdl.cmmn.trace.handler.DefaultTraceHandler;
import org.egovframe.rte.fdl.cmmn.trace.handler.TraceHandler;
import org.egovframe.rte.fdl.cmmn.trace.manager.DefaultTraceHandleManager;
import org.egovframe.rte.fdl.cmmn.trace.manager.TraceHandlerService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.AntPathMatcher;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
@Configuration
public class CommonConfig {
@Bean(name="jsonView")
public MappingJackson2JsonView getJsonView () {
ObjectMapper objectMapper = getObjectMapper();
MappingJackson2JsonView jsonView = new MappingJackson2JsonView(objectMapper);
jsonView.setExtractValueFromSingleKeyModel(true);
return jsonView;
}
@Bean(name = "objectMapper")
public ObjectMapper getObjectMapper() {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new JavaTimeModule());
//기본 날짜 포맷 비활성화
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
//새로운 날짜 포맷 세팅
/*SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
mapper.setDateFormat(dateFormat);
mapper.setTimeZone(TimeZone.getTimeZone("Asia/Seoul"));*/
return mapper;
}
@Bean
public AntPathMatcher antPathMatcher() {
return new AntPathMatcher();
}
@Bean
public DefaultTraceHandler defaultTraceHandler() {
return new DefaultTraceHandler();
}
@Bean
public DefaultTraceHandleManager traceHandlerService() {
DefaultTraceHandleManager defaultTraceHandleManager = new DefaultTraceHandleManager();
defaultTraceHandleManager.setReqExpMatcher(antPathMatcher());
defaultTraceHandleManager.setPatterns(new String[]{"*"});
defaultTraceHandleManager.setHandlers(new TraceHandler[]{defaultTraceHandler()});
return defaultTraceHandleManager;
}
@Bean
public LeaveaTrace leaveaTrace() {
LeaveaTrace leaveaTrace = new LeaveaTrace();
leaveaTrace.setTraceHandlerServices(new TraceHandlerService[]{traceHandlerService()});
return leaveaTrace;
}
}