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
ConstructorDescriptionSimpleEnvironmentVariablesProvider
(org.springframework.core.env.Environment environment) -
Method Summary
Modifier and TypeMethodDescriptiongetEnvironmentVariables
(org.springframework.batch.item.ExecutionContext executionContext) Provides aMap
of Strings to be used as environment variables.void
setEnvironmentProperties
(Map<String, String> environmentProperties) void
setIncludeCurrentEnvironment
(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
- TheEnvironment
for this context
-
-
Method Details
-
setEnvironmentProperties
- Parameters:
environmentProperties
- aMap
of 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:EnvironmentVariablesProvider
Provides aMap
of 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:
getEnvironmentVariables
in interfaceEnvironmentVariablesProvider
- Parameters:
executionContext
- theExecutionContext
associated with the worker's step- Returns:
- A
Map
of values to be used as environment variables
-