Its better to store the configuration properties in a database table so that it can be managed easily for different environments. The approach to store and retrieve the configuration properties from database table in xml based configuration is like below :
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
<property name="properties">
<bean class="org.apache.commons.configuration.ConfigurationConverter" factory-method="getProperties">
<constructor-arg>
<bean class="org.apache.commons.configuration.DatabaseConfiguration">
<constructor-arg>
<ref bean="dbDataSource" />
</constructor-arg>
<constructor-arg value="DOMAIN_CONFIG" />
<!-- DB Table -->
<constructor-arg value="CONFIG_NAME" />
<!-- DB Key Column -->
<constructor-arg value="CONFIG_VALUE" />
<!-- DB Value Column -->
</bean>
</constructor-arg>
</bean>
</property>
</bean>
But the same thing i'm trying to achieve using java based configuration but no luck. Can anyone please help me.
I found answer for my question.
Thanks to this post : https://gist.github.com/jeffsheets/8ab5f3aeb74787bdb051 This exactly suits to my problem. Thanks.!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With