Introduction
I'm working with a Spring-based webapp at the moment, in which we have two different implementations for the DAO beans:
These implementations are mapped using applicationContext files (we have two, one for each case described above). The way of using one or the other is having two different web.xml files and having the second one (e.g. "web-test.xml") containing something like this:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:{...}/applicationContext-test.xml</param-value>
</context-param>
In the configuration of the jetty plugin, we can override the web.xml:
<webAppConfig>
<contextPath>/${projectName}-test</contextPath>
<overrideDescriptor>${basedir}/web/WEB-INF/web-test.xml</overrideDescriptor>
</webAppConfig>
This works fine for using one applicationContext or the other, but we need to use both during integration testing, as some tests require DB access and others work with fake data.
Question
Is it possible to define several webAppConfigs so we can use either "web.xml" or "web-test.xml" depending on the contextPath used?
We would like to distinguish between the two cases accessing different urls, like:
We tried something like this on the pom.xml:
<webAppConfig>
<contextPath>/${projectName}</contextPath>
</webAppConfig>
<webAppConfig>
<contextPath>/${projectName}-test</contextPath>
<overrideDescriptor>${basedir}/web/WEB-INF/web-int-test.xml</overrideDescriptor>
</webAppConfig>
but the result is that the webAppConfig gets overrided by the second definition. Is there a way of having the two contexts accessible over the same Jetty instance?
Thank you in advance for your help.