我有一个Spring测试配置类,它应该覆盖xml-config中现有的bean。但我的问题是xmlbean覆盖了我的测试配置中用primary注释的bean。我尝试用不同的名称命名测试bean,但这对我也不起作用。@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(classes={CamelJmsTest.TestConfig.class})publicclassCamelJmsTest{@Configuration@ImportResource("classpath:production-beans-camel-
我的SpringBoot应用程序中有一个applicationContext.xml文件。在这个文件中,它有一个属性占位符-${profile.services.url}-用于配置bean的“地址”属性。在我的Application.java类中,我导入了这个文件。@ImportResource("classpath:applicationContext.xml")publicclassApplication{publicstaticvoidmain(String[]args){SpringApplication.run(Application.class,args);}}我在appl
我正在尝试查找使用Spring3@ImportResource注释导入多个Springxml上下文文件的语法。我尝试使用逗号分隔文件名,如下图所示,但这不起作用:@Configuration@ImportResource("spring-context1.xml","spring-context2.xml")publicclassConfigClass{}@ImportResource的文档说“表示一个或多个包含要导入的bean定义的资源。”所以我相信应该有一种方法来指定多个上下文文件。令人惊讶的是,我在Google上找不到任何示例 最佳答案