spring boot에서 application context xml 설정 읽기
15. Configuration classes
Spring Boot favors Java-based configuration. Although it is possible to call SpringApplication.run() with an XML source, we generally recommend that your primary source is a @Configuration class. Usually the class that defines the main method is also a good candidate as the primary @Configuration.
![]() |
Many Spring configuration examples have been published on the Internet that use XML configuration. Always try to use the equivalent Java-base configuration if possible. Searching for |
15.1 Importing additional configuration classes
You don’t need to put all your @Configuration into a single class. The @Import annotation can be used to import additional configuration classes. Alternatively, you can use @ComponentScan to automatically pickup all Spring components, including @Configuration classes.
You don’t need to put all your @Configuration into a single class. The @Import annotation can be used to import additional configuration classes. Alternatively, you can use @ComponentScan to automatically pickup all Spring components, including @Configuration classes.
15.2 Importing XML configuration
If you absolutely must use XML based configuration, we recommend that you still start with a @Configuration class. You can then use an additional@ImportResource annotation to load XML configuration files.
application-context.xml 소스 import하는 예제.
@ImportResource("classpath:application-context.xml")
public class Application { .. }
'general java' 카테고리의 다른 글
| [Spring] RestTemplate utf8 json 예제 (0) | 2015.05.15 |
|---|---|
| [spring boot] Intellij 14.1 지원 (0) | 2015.05.13 |
| [spring boot] application context xml import 하기 (0) | 2015.05.12 |
| Intellij + Spring boot, Loaded 사용시 팁 (mvn compile) (0) | 2015.05.08 |
| [Spring Boot, Loader] 이용할 때 내부 library와 함께 사용시 에러 해결 - BeanCreationException, ApplicationContextException: Unable to start embedded container (0) | 2015.05.08 |
| [play2] intellij 사용시 - FAILED DOWNLOADS xalan#serializer;2.7.1!serializer.jar (0) | 2015.05.08 |

![[Tip]](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/images/tip.png)


댓글을 달아 주세요