2

I am trying to get all the merged properties in my projects. Below is the section of my config file for properties.

<bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
    <property name="config" ref="environmentVariablesConfiguration" />
</bean>

<bean id="applicationProperties" class="org.jasypt.spring31.properties.EncryptablePropertyPlaceholderConfigurer">
    <constructor-arg ref="configurationEncryptor" />
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
    <property name="ignoreResourceNotFound" value="true" />
    <property name="locations">
        <list>
            <value>classpath:proj-config.properties</value>
            <value>classpath:${proj.env}-pauth-config.properties</value>
            <value>classpath:${proj.env}-pauth-override-config.properties</value>
        </list>
    </property>
</bean>

I tried with PropertiesFactoryBean class also but then my proj.env variable is not found. Suggest me how to retrieve all the merged properties in spring at runtime.

Xstian
  • 8,184
  • 10
  • 42
  • 72
Sumit Kumar
  • 402
  • 1
  • 6
  • 26
  • individually like [`@Value( "${jdbc.url}" )`](http://www.baeldung.com/2012/02/06/properties-with-spring/) or how do you mean retrieving all merged properties? – zapl Dec 07 '15 at 12:36
  • no, i mean retrieving key-value pairs of all the properties at the runtime. I have seen a method mergeProperties() of PropertiesFactoryBean but not able to access it – Sumit Kumar Dec 07 '15 at 13:09
  • Some properties are overrided based on environment variable, so i need some way to to get all these key-value pairs – Sumit Kumar Dec 07 '15 at 13:12
  • You can get the bean "applicationProperties" – reos Dec 07 '15 at 16:39
  • Can you show me with the code, i have tried but could not get the properties – Sumit Kumar Dec 07 '15 at 17:22

0 Answers0