Class SimpleEnvironmentVariablesProvider
java.lang.Object
org.springframework.cloud.task.batch.partition.SimpleEnvironmentVariablesProvider
- All Implemented Interfaces:
EnvironmentVariablesProvider
public class SimpleEnvironmentVariablesProvider
extends Object
implements EnvironmentVariablesProvider
Copies all existing environment variables as made available in the
Environment
only if includeCurrentEnvironment is set to true (default). The
environmentProperties option provides the ability to override any specific
values on an as needed basis.- Since:
- 1.0.2
- Author:
- Michael Minella
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleEnvironmentVariablesProvider(org.springframework.core.env.Environment environment) -
Method Summary
Modifier and TypeMethodDescriptiongetEnvironmentVariables(org.springframework.batch.item.ExecutionContext executionContext) Provides aMapof Strings to be used as environment variables.voidsetEnvironmentProperties(Map<String, String> environmentProperties) voidsetIncludeCurrentEnvironment(boolean includeCurrentEnvironment) Establishes if current environment variables will be included as a part of the provider.
-
Constructor Details
-
SimpleEnvironmentVariablesProvider
public SimpleEnvironmentVariablesProvider(org.springframework.core.env.Environment environment) - Parameters:
environment- TheEnvironmentfor this context
-
-
Method Details
-
setEnvironmentProperties
- Parameters:
environmentProperties- aMapof properties used to override any values configured in the currentEnvironment
-
setIncludeCurrentEnvironment
public void setIncludeCurrentEnvironment(boolean includeCurrentEnvironment) Establishes if current environment variables will be included as a part of the provider.- Parameters:
includeCurrentEnvironment- true(default) include local environment properties. False do not include current environment properties.
-
getEnvironmentVariables
public Map<String,String> getEnvironmentVariables(org.springframework.batch.item.ExecutionContext executionContext) Description copied from interface:EnvironmentVariablesProviderProvides aMapof Strings to be used as environment variables. This method will be called for each worker step. For example, if there are 5 partitions, this method will be called 5 times.- Specified by:
getEnvironmentVariablesin interfaceEnvironmentVariablesProvider- Parameters:
executionContext- theExecutionContextassociated with the worker's step- Returns:
- A
Mapof values to be used as environment variables
-