简体   繁体   中英

How can I put properties outside the project and load both properties project properties and outside project properties?

I'm setting up different projects on the same server and want to put the same properties on some path outside the tomcat folder and load project properties as well how can I achieve it so that load both project properties and properties on path.

You have asked 2 questions:

  • To put properties outside the project you have to create a custom class file that is extending the Resource bundle. For further details see this: Loading resources outside project
  • To load both properties you can load both with different var like:

    <.-- loading properties outside the project --> <resource-bundle> <base-name>com.yourpackage.CustomResourceBundle</base-name> <var>msgCustom</var> </resource-bundle> <.-- loading properties inside the project --> <resource-bundle> <base-name>com.yourpackage.resources.view</base-name> <var>msg</var> </resource-bundle>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM