我有maven spring应用程序具有这样的结构:
root
-core
-ws
-endpoints
-webapp
核心模块包含业务逻辑
端点模块包含类@WebService
Webapp模块包含web.xml
Endpoins模块有几个bean。
我的web.xml链接到主要上下文:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
applicationContext.xml导入端点模块的上下文
<import resource="classpath:ws-context.xml"/>
我可以通过两种方式启动应用程序:
当我通过Idea运行它时一切正常。当我使用jetty-maven-plugin时,我遇到了以下问题:
Spring找到ws-context.xml,但他没有读取它。我通过两个实验发现了它:
1.我重新编写了ws-context.xml,spring因错误而失败。
2.I使ws-context.xml无效,spring没有失败。
不幸的是,我丢失了我的豆子。有什么问题?
Jetty版本9+(我尝试了不同)。我的码头配置如下:
<configuration>
<war>${project.basedir}/target/${project.build.finalName}.war</war>
<systemProperties>
<force>true</force>
<systemProperty>
<name>jetty.home</name>
<value>/</value>
</systemProperty>
</systemProperties>
<webApp>
<contextPath>/</contextPath>
<extraClasspath>${basedir}/../../config/</extraClasspath>
</webApp>
</configuration>