Externalize Tomcat configuration

后端 未结 4 1418
轻奢々
轻奢々 2020-12-06 10:20

I have a DataSource configuration in context.xml. Is it possible not to hard-code database parameters in that file? For example, use an external properties file, and load th

4条回答
  •  一向
    一向 (楼主)
    2020-12-06 10:29

    If this is Tomcat 7, you can write your own org.apache.tomcat.util.IntrospectionUtils.PropertySource implementation read variables written like "${...}" in context.xml. You'll need to set the system property org.apache.tomcat.util.digester.PROPERTY_SOURCE to point to your PropertySource implementation.

提交回复
热议问题