Class BindableConfigurationBeanBinder

  • All Implemented Interfaces:
    io.microsphere.spring.context.config.ConfigurationBeanBinder

    public class BindableConfigurationBeanBinder
    extends java.lang.Object
    implements io.microsphere.spring.context.config.ConfigurationBeanBinder
    A ConfigurationBeanBinder implementation based on Spring Boot 2's Binder, which binds configuration properties to a given bean using Bindable.

    Example Usage

    
         Map<String, Object> properties = new HashMap<>();
         properties.put("app.name", "demo");
         MyConfigBean bean = new MyConfigBean();
         BindableConfigurationBeanBinder binder = new BindableConfigurationBeanBinder();
         binder.bind(properties, true, true, bean);
         // bean.getAppName() == "demo"
     
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    DefaultConfigurationBeanBinder, ConfigurationBeanBinder
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void bind​(java.util.Map<java.lang.String,​java.lang.Object> configurationProperties, boolean ignoreUnknownFields, boolean ignoreInvalidFields, java.lang.Object configurationBean)  
      void setConversionService​(org.springframework.core.convert.ConversionService conversionService)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BindableConfigurationBeanBinder

        public BindableConfigurationBeanBinder()
    • Method Detail

      • setConversionService

        public void setConversionService​(org.springframework.core.convert.ConversionService conversionService)
        Specified by:
        setConversionService in interface io.microsphere.spring.context.config.ConfigurationBeanBinder
      • bind

        public void bind​(java.util.Map<java.lang.String,​java.lang.Object> configurationProperties,
                         boolean ignoreUnknownFields,
                         boolean ignoreInvalidFields,
                         java.lang.Object configurationBean)
        Specified by:
        bind in interface io.microsphere.spring.context.config.ConfigurationBeanBinder