Class SystemPropertyInitializer

  • All Implemented Interfaces:
    org.springframework.beans.factory.InitializingBean

    public class SystemPropertyInitializer
    extends java.lang.Object
    implements org.springframework.beans.factory.InitializingBean
    Helper class that sets up a System property with a default value. A System property is created with the specified key name, and default value (i.e. if the property already exists it is not changed).
    Author:
    Dave Syer
    • Field Summary

      Fields 
      Modifier and TypeFieldDescription
      static java.lang.StringENVIRONMENT
      Name of system property used by default.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidafterPropertiesSet()
      Sets the System property with the provided name and default value.
      voidsetDefaultValue​(java.lang.String defaultValue)
      Mandatory property specifying the default value of the System property.
      voidsetKeyName​(java.lang.String keyName)
      Set the key name for the System property that is created.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ENVIRONMENT

        public static final java.lang.String ENVIRONMENT
        Name of system property used by default.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SystemPropertyInitializer

        public SystemPropertyInitializer()
    • Method Detail

      • setKeyName

        public void setKeyName​(java.lang.String keyName)
        Set the key name for the System property that is created. Defaults to ENVIRONMENT.
        Parameters:
        keyName - the key name to set
      • setDefaultValue

        public void setDefaultValue​(java.lang.String defaultValue)
        Mandatory property specifying the default value of the System property.
        Parameters:
        defaultValue - the default value to set
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Sets the System property with the provided name and default value.
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        java.lang.Exception
        See Also:
        InitializingBean.afterPropertiesSet()