I've got a webapp that is deployed in Tomcat.
The webapp uses a db.properties
file to resolve dataSource
bean properties in applicationContext.xml
:
<context:property-placeholder location="file:${catalina.home}/conf/db.properties"/>
In this example db.properties
file is placed in common /conf/
directory of the Tomcat.
And I want to place it not in common /conf/
, but in a separate subdirectory, like /conf/myapp/
, and myapp
should be configured not in application sources, but in Tomcat settings, like server.xml
.
I need it to deploy two copies of this webapp, but they should work with different databases.
How can I do this?
UPDATE
Here's my service
block from server.xml
<Service name="train">
<Connector port="8888" protocol="HTTP/1.1" connectionTimeout="20000" compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,text/json,application/x-javascript,application/javascript,application/json"/>
<Engine name="trainings" defaultHost="localhost">
<Host name="localhost" appBase="webapps">
<Context docBase="trs" path="" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs/train/int" prefix="access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />
</Host>
</Engine>
</Service>
<context:property-placeholder/>
in applicationContext.xml <Environment name="db.host" value="localhost" type="java.lang.String" override="false"/>
in server.xml in Context
section
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.