public class ConfigurationPropertiesBinderBuilder extends Object
ConfigurationPropertiesBinder
based on the state of the
ApplicationContext
.Modifier and Type | Field and Description |
---|---|
static String |
CONVERSION_SERVICE_BEAN_NAME
The bean name of the configuration properties conversion service.
|
static String |
VALIDATOR_BEAN_NAME
The bean name of the configuration properties validator.
|
Constructor and Description |
---|
ConfigurationPropertiesBinderBuilder(org.springframework.context.ApplicationContext applicationContext)
Creates an instance with the
ApplicationContext to use. |
Modifier and Type | Method and Description |
---|---|
ConfigurationPropertiesBinder |
build()
Build a
ConfigurationPropertiesBinder based on the state of the builder,
discovering the ConversionService and Validator if necessary. |
ConfigurationPropertiesBinderBuilder |
withConversionService(org.springframework.core.convert.ConversionService conversionService)
Specify the
ConversionService to use or null to use the default. |
ConfigurationPropertiesBinderBuilder |
withEnvironment(org.springframework.core.env.ConfigurableEnvironment environment)
Specify the
Environment to use, use all available
PropertySource . |
ConfigurationPropertiesBinderBuilder |
withPropertySources(Iterable<org.springframework.core.env.PropertySource<?>> propertySources)
Specify the
property sources to use. |
ConfigurationPropertiesBinderBuilder |
withValidator(org.springframework.validation.Validator validator)
Specify the
Validator to use or null to use the default. |
public static final String VALIDATOR_BEAN_NAME
public static final String CONVERSION_SERVICE_BEAN_NAME
public ConfigurationPropertiesBinderBuilder(org.springframework.context.ApplicationContext applicationContext)
ApplicationContext
to use.applicationContext
- the application contextpublic ConfigurationPropertiesBinderBuilder withConversionService(org.springframework.core.convert.ConversionService conversionService)
ConversionService
to use or null
to use the default.
By default, use a ConversionService
bean named
"conversionService" if any. Otherwise create a
DefaultConversionService
with any ConfigurationPropertiesBinding
qualified Converter
and GenericConverter
beans found in the
context.
conversionService
- the conversion service to use or null
public ConfigurationPropertiesBinderBuilder withValidator(org.springframework.validation.Validator validator)
Validator
to use or null
to use the default.
By default, use a Validator
bean named "configurationPropertiesValidator" if
any. If not, create a JSR 303 Validator if the necessary libraries are available.
No validation occurs otherwise.
validator
- the validator to use or null
public ConfigurationPropertiesBinderBuilder withPropertySources(Iterable<org.springframework.core.env.PropertySource<?>> propertySources)
property sources
to use.propertySources
- the configuration the binder should usewithEnvironment(ConfigurableEnvironment)
public ConfigurationPropertiesBinderBuilder withEnvironment(org.springframework.core.env.ConfigurableEnvironment environment)
Environment
to use, use all available
PropertySource
.environment
- the environment to usewithPropertySources(Iterable)
public ConfigurationPropertiesBinder build()
ConfigurationPropertiesBinder
based on the state of the builder,
discovering the ConversionService
and Validator
if necessary.ConfigurationPropertiesBinder
Copyright © 2017 Pivotal Software, Inc.. All rights reserved.