类 PropertiesConfigurationFactory<T>

  • 类型参数:
    T - the target type
    所有已实现的接口:
    org.springframework.beans.factory.Aware, org.springframework.beans.factory.FactoryBean<T>, org.springframework.beans.factory.InitializingBean, org.springframework.context.MessageSourceAware

    public class PropertiesConfigurationFactory<T>
    extends Object
    implements org.springframework.beans.factory.FactoryBean<T>, org.springframework.context.MessageSourceAware, org.springframework.beans.factory.InitializingBean
    Validate some Properties (or optionally PropertySources) by binding them to an object of a specified type and then optionally running a Validator over it.
    • 方法详细资料

      • setIgnoreNestedProperties

        public void setIgnoreNestedProperties​(boolean ignoreNestedProperties)
        Flag to disable binding of nested properties (i.e. those with period separators in their paths). Can be useful to disable this if the name prefix is empty and you don't want to ignore unknown fields.
        参数:
        ignoreNestedProperties - the flag to set (default false)
      • setIgnoreUnknownFields

        public void setIgnoreUnknownFields​(boolean ignoreUnknownFields)
        Set whether to ignore unknown fields, that is, whether to ignore bind parameters that do not have corresponding fields in the target object.

        Default is "true". Turn this off to enforce that all bind parameters must have a matching field in the target object.

        参数:
        ignoreUnknownFields - if unknown fields should be ignored
      • setIgnoreInvalidFields

        public void setIgnoreInvalidFields​(boolean ignoreInvalidFields)
        Set whether to ignore invalid fields, that is, whether to ignore bind parameters that have corresponding fields in the target object which are not accessible (for example because of null values in the nested path).

        Default is "false". Turn this on to ignore bind parameters for nested objects in non-existing parts of the target object graph.

        参数:
        ignoreInvalidFields - if invalid fields should be ignored
      • setTargetName

        public void setTargetName​(String targetName)
        Set the target name.
        参数:
        targetName - the target name
      • setMessageSource

        public void setMessageSource​(org.springframework.context.MessageSource messageSource)
        Set the message source.
        指定者:
        setMessageSource 在接口中 org.springframework.context.MessageSourceAware
        参数:
        messageSource - the message source
      • setPropertySources

        public void setPropertySources​(org.springframework.core.env.PropertySources propertySources)
        Set the property sources.
        参数:
        propertySources - the property sources
      • setConversionService

        public void setConversionService​(org.springframework.core.convert.ConversionService conversionService)
        Set the conversion service.
        参数:
        conversionService - the conversion service
      • setValidator

        public void setValidator​(org.springframework.validation.Validator validator)
        Set the validator.
        参数:
        validator - the validator
      • setExceptionIfInvalid

        @Deprecated
        public void setExceptionIfInvalid​(boolean exceptionIfInvalid)
        已过时。
        as of 1.5, do not specify a Validator if validation should not occur
        Set a flag to indicate that an exception should be raised if a Validator is available and validation fails.
        参数:
        exceptionIfInvalid - the flag to set
      • setResolvePlaceholders

        public void setResolvePlaceholders​(boolean resolvePlaceholders)
        Flag to indicate that placeholders should be replaced during binding. Default is true.
        参数:
        resolvePlaceholders - flag value
      • getObjectType

        public Class<?> getObjectType()
        指定者:
        getObjectType 在接口中 org.springframework.beans.factory.FactoryBean<T>
      • isSingleton

        public boolean isSingleton()
        指定者:
        isSingleton 在接口中 org.springframework.beans.factory.FactoryBean<T>
      • getObject

        public T getObject()
                    throws Exception
        指定者:
        getObject 在接口中 org.springframework.beans.factory.FactoryBean<T>
        抛出:
        Exception
      • bindPropertiesToTarget

        public void bindPropertiesToTarget()
                                    throws org.springframework.validation.BindException
        抛出:
        org.springframework.validation.BindException
      • customizeBinder

        protected void customizeBinder​(org.springframework.validation.DataBinder dataBinder)
        Customize the data binder.
        参数:
        dataBinder - the data binder that will be used to bind and validate