org.riotfamily.common.beans.config
Class PlaceholderWithDefaultConfigurer

java.lang.Object
  extended by org.springframework.core.io.support.PropertiesLoaderSupport
      extended by org.springframework.beans.factory.config.PropertyResourceConfigurer
          extended by org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
              extended by org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer
                  extended by org.riotfamily.common.beans.config.PropertiesPlaceholderConfigurer
                      extended by org.riotfamily.common.beans.config.PlaceholderWithDefaultConfigurer
All Implemented Interfaces:
BeanFactoryAware, BeanNameAware, BeanFactoryPostProcessor, Ordered, PriorityOrdered, ServletContextAware

public class PlaceholderWithDefaultConfigurer
extends PropertiesPlaceholderConfigurer

PropertyPlaceholderConfigurer that allows to define inline default values.

Example:

 <bean class="org.riotfamily.example.HelloWorld">
     <property name="message" value="${hello.message=Hello World}" />
 </bean>
 
Since Riot 7.0 you can specify null as default value:
 <bean class="org.riotfamily.example.HelloWorld">
     <property name="message" value="${hello.message=}" />
 </bean>
 
Please note the the trailing equals sign. If omitted, the behavior will depend on the setting of the ignoreUnresolvablePlaceholders flag.


Field Summary
static String DEFAULT_VALUE_SEPARATOR
           
 
Fields inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, SYSTEM_PROPERTIES_MODE_FALLBACK, SYSTEM_PROPERTIES_MODE_NEVER, SYSTEM_PROPERTIES_MODE_OVERRIDE
 
Fields inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
logger, XML_FILE_EXTENSION
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
PlaceholderWithDefaultConfigurer()
           
 
Method Summary
protected  void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props)
           
protected  String resolvePlaceholder(String placeholder, Properties props, int systemPropertiesMode)
           
 void setBeanFactory(BeanFactory beanFactory)
           
 void setBeanName(String beanName)
           
 void setValueSeparator(String valueSeparator)
           
 
Methods inherited from class org.riotfamily.common.beans.config.PropertiesPlaceholderConfigurer
resolveAll, resolvePlaceholder
 
Methods inherited from class org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer
resolvePlaceholder, setContextOverride, setSearchContextAttributes, setServletContext
 
Methods inherited from class org.springframework.beans.factory.config.PropertyPlaceholderConfigurer
parseStringValue, resolveSystemProperty, setIgnoreUnresolvablePlaceholders, setNullValue, setPlaceholderPrefix, setPlaceholderSuffix, setSearchSystemEnvironment, setSystemPropertiesMode, setSystemPropertiesModeName
 
Methods inherited from class org.springframework.beans.factory.config.PropertyResourceConfigurer
convertProperties, convertPropertyValue, getOrder, postProcessBeanFactory, setOrder
 
Methods inherited from class org.springframework.core.io.support.PropertiesLoaderSupport
loadProperties, mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VALUE_SEPARATOR

public static final String DEFAULT_VALUE_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

PlaceholderWithDefaultConfigurer

public PlaceholderWithDefaultConfigurer()
Method Detail

setValueSeparator

public void setValueSeparator(String valueSeparator)

setBeanName

public void setBeanName(String beanName)
Specified by:
setBeanName in interface BeanNameAware
Overrides:
setBeanName in class PropertyPlaceholderConfigurer

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
Specified by:
setBeanFactory in interface BeanFactoryAware
Overrides:
setBeanFactory in class PropertyPlaceholderConfigurer

processProperties

protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess,
                                 Properties props)
                          throws BeansException
Overrides:
processProperties in class PropertyPlaceholderConfigurer
Throws:
BeansException

resolvePlaceholder

protected String resolvePlaceholder(String placeholder,
                                    Properties props,
                                    int systemPropertiesMode)
Overrides:
resolvePlaceholder in class PropertyPlaceholderConfigurer