无法从其他Maven模块加载应用程序上下文 [英] Application context from other maven module cannot be loaded
问题描述
我有一个多模块maven项目,其中每个maven模块在src/main/resources
下都有其自己的应用程序上下文.这些多模块项目之一是Web应用程序,该应用程序的应用程序上下文正在导入其他Maven模块的应用程序上下文.我正在使用
I have multi module maven project where each maven module has its own application context under src/main/resources
. One of these multi module project is web application and application context of the application is importing application contexts of other maven modules. I am using similar pom configuration as it is mentioned in this link.
我的问题是,Web应用程序的应用程序上下文无法加载其他Maven模块jar的应用程序上下文.我认为应该有一些可能,但我无法弄清楚.我已经考虑过使用或不使用正则表达式的应用程序导入命令,但是都没有成功.
My Problem is, application context of web application is unable to load application contexts of other maven modules, jars. I think it should be some how possible but i am unable to figure it. I have reconsidered application importing command with or without regex, but no success.
如果您根据示例解释上述问题,我将非常感谢.
I would be highly thankful if you explain the aforementioned problem in light of an example.
推荐答案
我始终按照您的描述在多模块Maven项目中一直这样做.只需例如
I do this all the time in multi-module Maven projects exactly as you describe. Just have e.g.
<import resource="classpath*:/META-INF/spring/*.xml" />
在您的Web应用程序的应用程序上下文中,这将在所有依赖模块的/META-INF/spring
下导入所有Spring配置.如果不是,则可能不会将有关模块声明为Webapp的依赖项?
in your webapps's application context and this will import all the Spring configuration under /META-INF/spring
in all of its dependent modules. If not, maybe the modules concerned aren't declared as dependencies of the webapp?
这篇关于无法从其他Maven模块加载应用程序上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!