【发布时间】:2021-12-01 20:33:10
【问题描述】:
我有两个春季项目,
项目 A:使用 xml bean 配置构建。
Project B : 是使用 Annotations 构建的; A依赖于B;
如何在 A applicationContext 中加载 B bean。
我搜索但我发现如何使用注释加载 xml bean:@ImportResource
有没有办法做到这一点而不必创建两个应用程序上下文:
ApplicationContext applicationContextA = new ClassPathXmlApplicationContext("classpath:/applicationContextA.xml");
ApplicationContext applicationContextB = new AnnotationConfigApplicationContext(BConfiguration.class);
【问题讨论】:
标签: java spring-framework-beans