Package org.springframework.batch.support

# Class SystemPropertyInitializer

java.lang.Object
org.springframework.batch.support.SystemPropertyInitializer

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

public class SystemPropertyInitializer extends 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 Type
  Field
  Description
  `static final String`
  `ENVIRONMENT`
  Name of system property used by default.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SystemPropertyInitializer()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `afterPropertiesSet()`
  Sets the System property with the provided name and default value.
  `void`
  `setDefaultValue(String defaultValue)`
  Mandatory property specifying the default value of the System property.
  `void`
  `setKeyName(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 Details

  - ### ENVIRONMENT

    public static final String ENVIRONMENT
    Name of system property used by default.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SystemPropertyInitializer

    public SystemPropertyInitializer()

- ## Method Details

  - ### setKeyName

    public void setKeyName(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(String defaultValue)
    Mandatory property specifying the default value of the System property.
    Parameters:
      `defaultValue` - the default value to set

  - ### afterPropertiesSet

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