← Back to team overview

dhis2-devs team mailing list archive

Re: Moving dhis.conf as a classpath resource

 

Hi Vanya,

thanks for the suggestion. We do not plan to do this at this point, as
arbitrary config properties can become unwieldy.

I propose that you instead extend the settings app with new properties
under Synchronization and base it on system settings (this will be more
dynamic):

https://play.dhis2.org/demo/dhis-web-settings/#

If you really need compile time (application context startup time)
configuration properties, then you could create a spring factory bean in
combination with the DhisConfigurationProvider, something like this:

class DhisConfigurationPropertyFactoryBean
  implements FactoryBean<String>

which uses the DhisConfigurationProvider to look up a given property. Have
a look at ConnectionPropertyFactoryBean.java for reference.

regards,

Lars



On Tue, Mar 8, 2016 at 10:28 AM, Vanya Seth <vanyas@xxxxxxxxxxxxxxxx> wrote:

> Hi Lars
>
> Had a question regarding dhis.conf being external to the system( as in, in
> the DHIS2 home).
> Would there be a chance where we plan to move this properties file as a
> classpath resource.
> There are multiple advantages to it.  Please see this snippet for more
> details:
>
> <bean id="retryPolicy" class ="org.springframework.retry.policy.SimpleRetryPolicy">
>   <property name="maxAttempts" value="*${metadata.sync.retry}"*/>
> </bean>
>
> <bean id="dhisProperties"
>       class="*org.springframework.beans.factory.config.PropertyPlaceholderConfigurer*">
>   <property name="location" value="classpath:dhis.conf" />
> </bean>
>
> We can leverage Spring's *PropertyPlaceholderConfigurer *to substitute
> the property placeholders dynamically.
> We can also inject the property values using the @Value annotation.
>
> Any thoughts?
>
> --
> With Regards
> Vanya
> ThoughtWorks Technologies
> Hyderabad
>
> --Stay Hungry Stay Foolish!!
>



-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org <https://www.dhis2.org/>

Follow ups

References