I want to externalize my configuration with Spring Boot, but I want to continue to partially use my xml context.
My main class SpringServerApplication.java :
Use <context:property-placeholder/> in applicationContext.xml
And import xml based configuration like this:
@ImportResource({"classpath*:applicationContext.xml"})
Remove the @PropertySource as that is already done by Spring Boot, instead add @EnableAutoConfiugration and use @ImportResource to import your xml config files.
@Configuration
@EnableAutoConfiguration
@ImportResource("classpath:ApplicationContextServer.xml")
public class SpringServerApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(new Object[] {SpringServerApplication.class}, args);
}
}
That should be enough to do what you want. Depending on the content in your xml file you might even be able to drop some of it (as Spring Boot can quite easily do auto configuration of resources for you).