用于库使用的Spring IoC上下文配置?

时间:2011-03-08 02:18:07

标签: java spring ioc-container

我有一个应用程序A和一个库B.

相应地,上下文配置文件:a.xmlb.xmlb.xml未完成,需要a.xml才能正常工作。

但是,我import b.xml中的a.xml不能,因为b.xml的路径未确定。我想要一些自动发现使用。 (可能类似于java.util.ServiceLoader。)

有可能吗?

1 个答案:

答案 0 :(得分:1)

对库定义的bean使用@Configuration,Spring将最终集成在上下文xmls中为主应用程序定义的所有@Configuration bean和bean。