diff --git a/src/main/java/cokr/xit/foundation/boot/CommonConfig.java b/src/main/java/cokr/xit/foundation/boot/CommonConfig.java deleted file mode 100644 index ee07577..0000000 --- a/src/main/java/cokr/xit/foundation/boot/CommonConfig.java +++ /dev/null @@ -1,113 +0,0 @@ -package cokr.xit.foundation.boot; - -import java.text.SimpleDateFormat; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.egovframe.rte.fdl.cmmn.trace.LeaveaTrace; -import org.egovframe.rte.fdl.property.impl.EgovPropertyServiceImpl; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.support.ReloadableResourceBundleMessageSource; -import org.springframework.core.env.Environment; -import org.springframework.util.AntPathMatcher; - -import com.fasterxml.jackson.core.JsonParser.Feature; -import com.fasterxml.jackson.databind.ObjectMapper; - -/**전자정부 프레임웤과 xit foundation을 사용하는 애플리케이션의 공통 Bean들을 설정한다. - * @author mjkhan - */ -@Configuration -@ComponentScan(basePackages = "cokr.xit") -public class CommonConfig { - final Environment env; - - public CommonConfig(Environment env) { - this.env = env; - } - - /**AntPathMatcher를 반환한다. - * @return AntPathMatcher - */ - @Bean - public AntPathMatcher antPathMatcher() { - return new AntPathMatcher(); - } - - /**ObjectMapper를 반환한다. - * @return ObjectMapper - */ - @Bean - public ObjectMapper objectMapper() { - ObjectMapper bean = new ObjectMapper(); - bean.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); - bean.configure(Feature.ALLOW_COMMENTS, true); - return bean; - } - - /**LeaveaTrace를 반환한다. - * @return LeaveaTrace - */ - @Bean - public LeaveaTrace leaveaTrace() { - return new LeaveaTrace(); - } - - //private Yml yml = new Yml("application.yml", "application.yml", env); - @Bean - public Yml yml() { - return new Yml("application.yml", "application.yml", env); - } - - /**application.yml의 설정 내용을 읽어 MessageSource Bean을 설정하여 반환한다. - *
messageSource:
- * basenames:
- * - classpath:message/message-common
- * - classpath:message/authentication-message
- * - classpath:org/egovframe/rte/fdl/property/messages/properties
- * @return ReloadableResourceBundleMessageSource
- */
- @Bean
- public ReloadableResourceBundleMessageSource messageSource() {
- ReloadableResourceBundleMessageSource bean = new ReloadableResourceBundleMessageSource();
- bean.setDefaultEncoding("UTF-8");
- bean.setCacheSeconds(60);
-
- List propertyService:
- * properties: # 인라인 프로퍼티가 있을 경우
- * - property0: value0
- * - property1: value1
- * extFileName: #외부 프로퍼티 파일이 있을 경우
- * - encoding: UTF-8
- * filename: classpath*:properties/your-file-01.properties
- * - encoding: UTF-8
- * filename: classpath*:properties/your-file-02.properties
- * @return EgovPropertyServiceImpl
- */
- @Bean
- public EgovPropertyServiceImpl propertyService() {
- EgovPropertyServiceImpl bean = new EgovPropertyServiceImpl();
-
- Map
- * @author mjkhan
- */
-public class Yml {
- private Map
- * @return 지정하는 키의 프로퍼티 값
- */
- public String getValue(String key) {
- if (source == null) return "";
-
- Object obj = source.get(key);
- return obj != null ? obj.toString() : "";
- }
-
- /**지정하는 문자열로 시작하는 프로퍼티(아래 참고) 값들을 반환한다.
- * spring:
- * application:
- * name: my-application
- *
- * @param prefix 프로퍼티 접두어
- * @return 지정하는 문자열로 시작하는 프로퍼티 값
- */
- public List list:
- * - item-0
- * - item-2
- * - item-3
- * @param prefix 프로퍼티 접두어
- * @return 지정하는 문자열로 시작하는 프로퍼티로 된 Map
- */
- public Map parent:
- * - property-0: value-0
- * - property-1: value-1
- * - property-2: value-2
- * @param prefix 프로퍼티 접두어
- * @return 지정하는 문자열로 시작하는 프로퍼티들의 Map 목록
- */
- public List parent:
- * - property-0: value-0.0
- * property-1: value-0.1
- * - property-0: value-1.0
- * property-1: value-1.1