Announcement Announcement Module
Collapse
No announcement yet.
How to write to a properties file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to write to a properties file

    Hi.

    Say I have a properties file declared somewhere in a similar fascin as this:

    Code:
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    		<property name="location"><value>/WEB-INF/jdbc.properties</value></property>
    	</bean>
    How do yo, from inside say a Controller implementation, access and write to this file?

  • #2
    I don't think this is going to work as you intended. PropertyPlaceholderConfigurer is used at application context startup time, so the properties will have been configured by the time your Controller is available to service requests. Instead you'll need to find another way to update bean settings of an already running application context, such as via JMX.

    Comment


    • #3
      OK.

      I'm not very familiar with JMX, have to check it up.

      So you're basically saying that there is no direct way of writing to a property holder att runtime? So I guess one is left with the old way of saving property files via a Stream of some sort then.

      Thanks, this is useful information.

      Comment

      Working...
      X