Externalizing tomcat jdbc connection pool information for different environments

妖精的绣舞 提交于 2019-12-13 12:14:07

问题


Greetings,

I'm looking for a good solution for externalizing the JNDI connection pool information in context.xml of a war so that as the application moves from dev to QA to prod, the war file won't need to be recompiled. Ideally the url, driver, username and password would be variablized and then populated by means of a properties file that would customized for each environment. If this isn't possible, are there other suggestions on how to handle moving a war across environments without recompiling for a target environment? Maven provides profiles this requires a build targeted at a specific environment.

Thanks in advance.


回答1:


Why don't you just configure this at the Tomcat level instead of embedding a context.xml? To me, this makes particularly sense since Dev, QA, Prod can use different pool settings. And by this, I mean the configuration/sizing of the pool, not only not only the url, username and password.




回答2:


You can have a context.xml that lives outside the WAR files in the common "conf" directory. See the docs.



来源:https://stackoverflow.com/questions/1977092/externalizing-tomcat-jdbc-connection-pool-information-for-different-environments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!