I'm using spring-boot
and would like to automatically import src/main/resources/applicationContext.xml
file.
So far it only works if I explicit tell spring to import it:
@EnableAutoConfiguration
@Configuration
@ImportResource({"classpath*:applicationContext.xml"})
But spring-boot has so many default, maybe someone knows the "default" name for the app.xml file so that is gets picked up by spring-boot by default?
src/main/resources/applicationContext.xml: properties in src/main/resources too.
Spring can be easily integrated into any Java-based web framework. All you need to do is to declare the ContextLoaderListener in your web. xml and use a contextConfigLocation to set which context files to load. You can then use the WebApplicationContext to get a handle on your beans.
ClassPathXmlApplicationContext − This container loads the definitions of the beans from an XML file. Here you do not need to provide the full path of the XML file but you need to set CLASSPATH properly because this container will look like bean configuration XML file in CLASSPATH.
There is no such feature for importing an XML configuration by default based on it's name or location.
Check out this part of the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With