문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판 이전 판 다음 판 | 이전 판 | ||
|
springframework:propertysource [2013/06/24 23:48] kwon37xi |
springframework:propertysource [2017/08/11 09:04] (현재) kwon37xi |
||
|---|---|---|---|
| 줄 4: | 줄 4: | ||
| * 시스템 프라퍼티, | * 시스템 프라퍼티, | ||
| * [[http:// | * [[http:// | ||
| + | * [[http:// | ||
| ===== 프라퍼티 추가 ===== | ===== 프라퍼티 추가 ===== | ||
| * 일반 프라퍼티 파일의 경우 | * 일반 프라퍼티 파일의 경우 | ||
| * Java 클래스 설정에서는 [[http:// | * Java 클래스 설정에서는 [[http:// | ||
| * < | * < | ||
| + | |||
| ===== 코딩을 통한 임의의 프라퍼티 소스 추가 ===== | ===== 코딩을 통한 임의의 프라퍼티 소스 추가 ===== | ||
| * '' | * '' | ||
| 줄 25: | 줄 26: | ||
| </ | </ | ||
| </ | </ | ||
| - | * '' | + | * TestContext에서 |
| @ContextConfiguration(initializers = MyInitializer.class) | @ContextConfiguration(initializers = MyInitializer.class) | ||
| </ | </ | ||
| 줄 36: | 줄 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() | ||
| </ | </ | ||
| 줄 114: | 줄 130: | ||
| --> | --> | ||
| </ | </ | ||
| + | |||
| + | ===== ResourceLoader ===== | ||
| + | * '' | ||
| + | * 단, '' | ||
| + | * 그냥 속 편하게 [[http:// | ||
| + | |||
| + | ===== @Value ===== | ||
| + | ==== @Value로 Date 객체 주입하기 ==== | ||
| + | * [[http:// | ||
| + | @Value("# | ||
| + | private Date date; | ||
| + | </ | ||
| + | * [[http:// | ||