java - Using multiple property files (via PropertyPlaceholderConfigurer) in multiple projects/modules -
We are currently writing an application that is divided into several projects / modules. For example, let's take the following modules:
- myApp-DAO
- myApp-jabber
Each module's own spring reference For Xml file DAO module, I have a propertyplaceholder's configurator that reads a required file with DB connection parameters. I also have a PropertyPlaceHolderConfigurer for the connection properties for Iqbal module in the Jabber module.
now comes in the main application, which includes my app- DAO and myApp-jabber. It reads all reference files and starts a large spring reference. Unfortunately, it seems that there can only be a reference to a propertyplaceholder's configurator, so whatever module is loaded it is able to read the connection parameters first. . The second one throws an exception with an error such as "placeholder 'jabber.host' 'can not be resolved."
I understand what the problem is, but I do not really know the solution - or best practice for my use.
How do I configure each module so that each one can load its own property file? Right now I have transferred PropertyPlaceHolderConfigurer out of different reference files and merged them in the context of the main application (loading all the property files with a PropertyPlaceHolderConfigurer) This is useless though, because now people who use Dow Module They should know, they should know, in their context, they need the location of the property. Apart from this, integration tests also fail in the Dow module.
I'm eager to hear about solutions / ideas from the Stackhouseflu community ..
If you ensure that the holders in each place are included in these references in each, ignoring the anarolaval keys, then work in both ways, for example:
& lt; Reference: Asset-placeholder location = "Classpath: Dao properties, classpath: services.properties, classpath: user.properties" unseen-anarolwable = "true" />
or
& lt; Bean id = "Property Configurator" class = "org.springframework.beans.factory .config.PropertyPlaceholderConfigurer" & gt; & Lt; Property Name = "Location" & gt; & Lt; List & gt; & Lt; Price & gt; Classpath: dao.properties & lt; / Pricing & gt; & Lt; Price & gt; Classpath: services.properties & lt; / Pricing & gt; & Lt; Price & gt; Classpath: user.properties & lt; / Pricing & gt; & Lt; / List & gt; & Lt; / Property & gt; & Lt; Property Name = "Undiscovered Unchanged Placeholders" Value = "Correct" /> & Lt; / Bean & gt;
Comments
Post a Comment