문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
springframework:propertysource [2013/06/24 23:47] kwon37xi [@Configuration 클래스에서 XML 프라퍼티를 프라퍼티 소스로 등록하기 예제] |
springframework:propertysource [2015/10/05 13:28] kwon37xi [ResourceLoader] |
||
---|---|---|---|
줄 4: | 줄 4: | ||
* 시스템 프라퍼티, | * 시스템 프라퍼티, | ||
* [[http:// | * [[http:// | ||
+ | * [[http:// | ||
===== 프라퍼티 추가 ===== | ===== 프라퍼티 추가 ===== | ||
* 일반 프라퍼티 파일의 경우 | * 일반 프라퍼티 파일의 경우 | ||
* Java 클래스 설정에서는 [[http:// | * Java 클래스 설정에서는 [[http:// | ||
* < | * < | ||
+ | |||
===== 코딩을 통한 임의의 프라퍼티 소스 추가 ===== | ===== 코딩을 통한 임의의 프라퍼티 소스 추가 ===== | ||
* '' | * '' | ||
줄 24: | 줄 25: | ||
< | < | ||
</ | </ | ||
+ | </ | ||
+ | * TestContext에서 '' | ||
+ | @ContextConfiguration(initializers = MyInitializer.class) | ||
</ | </ | ||
* '' | * '' | ||
줄 33: | 줄 37: | ||
} | } | ||
} | } | ||
+ | </ | ||
+ | |||
+ | ==== ApplicationContextInitializer를 Java 코드 기반 ApplicationContext에서 사용하기 ==== | ||
+ | * [[http:// | ||
+ | // Create context, but dont initialize with configuration by calling | ||
+ | // the empty constructor. Instead, initialize it with the Context Initializer. | ||
+ | AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); | ||
+ | MyAppContextInitializer initializer = new MyAppContextInitializer(); | ||
+ | |||
+ | // ApplicationContextInitializer가 ApplicationContext를 초기화해주는 형태 | ||
+ | initializer.initialize( ctx ); | ||
+ | |||
+ | // @Configuration 클래스를 등록하고 초기화 | ||
+ | ctx.register( com.my.classpath.StackOverflowConfiguration.class ); | ||
+ | ctx.refresh() | ||
</ | </ | ||
줄 111: | 줄 130: | ||
--> | --> | ||
</ | </ | ||
+ | |||
+ | ===== ResourceLoader ===== | ||
+ | * '' | ||
+ | * 단, '' | ||
+ | * 그냥 속 편하게 [[http:// |