Announcement Announcement Module
Collapse
No announcement yet.
Show all properties from PropertySourcesPlaceholderConfigurer Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Show all properties from PropertySourcesPlaceholderConfigurer

    So I'm using the 3.1 PropertySourcesPlaceholderConfigurer. What I want to do on my server startup is print out all the properties (key+values) that have been loaded up. I am over-riding some so just want to print out everything.

    Everything is working fine, I just want to print this as a sanity check for debugging.

    I tried searching and I dont see any obvious getters on the bean so appreciate any pointers. Thanks in advance.

    This is how I have it declared:
    Code:
    <bean id="serverProperties" class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
            <property name="locations" >
                <list>
                    <value>classpath:properties/default.properties</value>
                    <value>file:${user.home}/override.properties</value>
                </list>
            </property>
            <property name="ignoreResourceNotFound" value="true"/>
        </bean>

  • #2
    subclass
    org.springframework.context.support.PropertySource sPlaceholderConfigurer
    and implement
    org.springframework.beans.factory.InitializingBean
    . Write code in here to print using the protected mergeProperties() method

    Comment


    • #3
      Nice, that does the trick. Thanks

      Comment

      Working...
      X