[英]How do I load Spring bean definitions from XML file specified in a properties file?
I specified name of XML file with Spring bean definitions in a properties file: 我在属性文件中用Spring bean定义指定了XML文件的名称:
myConfigurationFile=mySpringConfigurationFile1.xml myConfigurationFile = mySpringConfigurationFile1.xml
How do I tell Spring to load those bean definitions into Spring context defined by JavaConfig? 如何告诉Spring将这些bean定义加载到JavaConfig定义的Spring上下文中? It seems that I need an equivalent of @ImportResource, called programmatically from JavaConfig.
似乎我需要一个等效的@ImportResource,可以从JavaConfig中以编程方式调用。 How do I do that?
我怎么做?
Hi you can use FileSystemXmlApplicationContext or ClassPathXmlApplicationContext to achieve this. 嗨,您可以使用FileSystemXmlApplicationContext或ClassPathXmlApplicationContext实现此目的。
https://docs.spring.io/spring/docs/3.0.0.M4/reference/html/ch04s07.html https://docs.spring.io/spring/docs/3.0.0.M4/reference/html/ch04s07.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.