Results 1 to 3 of 3

Thread: Show all properties from PropertySourcesPlaceholderConfigurer

  1. #1
    Join Date
    Nov 2012
    Posts
    2

    Default 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. #2
    Join Date
    Dec 2009
    Location
    India
    Posts
    108

    Default

    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

  3. #3
    Join Date
    Nov 2012
    Posts
    2

    Default

    Nice, that does the trick. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •