Skip to content

Spring configuration management in Equinox_83722259

nxi edited this page Apr 9, 2015 · 1 revision

Gumtree : Spring configuration management in Equinox

Created by Tony Lam, last modified on May 21, 2008
Spring supports configuration management via properties substitutiion in its XML bean context.  The following is the XML example:
  <bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
    <property name="properties">
      <props>
        <prop key="restlet.serverPort">9876</prop>
      </props>
    </property>
  </bean>
 
  <bean id="jettyServer" class="com.noelios.restlet.equinox.JettyStarter" init-method="init" destroy-method="cleanup">
    <property name="port" value="${restlet.serverPort}" />
  </bean>
System properties should look something like this: 
# Production port
restlet.serverPort = 9999
Above uses the system properties to override the bean settings.  In Equinox, all system property are kept in the config.ini.  To enable the Spring PropertyPlaceholderConfigurer, you need to import package org.springframework.beans.factory.config.  This placeholder allows default settings (in case it cannot resolve from the system properties).  To enable this, import package org.springframework.core.io.support. References: Configuration management with Spring: http://blog.arendsen.net/index.php/2005/03/12/configuration-management-with-spring/  Spring PropertyPlaceholderConfigurer with default value: http://thiamteck.blogspot.com/2008/04/spring-propertyplaceholderconfigurer.html
Document generated by Confluence on Apr 01, 2015 00:11
Clone this wiki locally