类 ConfigCenterPropertyPlaceholderConfigurer

  • 所有已实现的接口:
    EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.config.BeanFactoryPostProcessor, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener, org.springframework.context.EnvironmentAware, org.springframework.core.Ordered, org.springframework.core.PriorityOrdered

    public class ConfigCenterPropertyPlaceholderConfigurer
    extends org.springframework.context.support.PropertySourcesPlaceholderConfigurer
    implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.DisposableBean, org.springframework.context.ApplicationListener
    A extend utility class for spring property configuration resolve from configuration center server.
    • 字段概要

      字段 
      修饰符和类型 字段 说明
      protected Properties cachedProps  
      protected Properties ccLoadedProps
      local cached props load from configuration center
      static String RCC_PROPERTIES_PROPERTY_SOURCE_NAME
      rccProperties
      protected Properties rccProperties  
      • 从类继承的字段 org.springframework.context.support.PropertySourcesPlaceholderConfigurer

        ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME, LOCAL_PROPERTIES_PROPERTY_SOURCE_NAME
      • 从类继承的字段 org.springframework.beans.factory.config.PlaceholderConfigurerSupport

        DEFAULT_PLACEHOLDER_PREFIX, DEFAULT_PLACEHOLDER_SUFFIX, DEFAULT_VALUE_SEPARATOR, ignoreUnresolvablePlaceholders, nullValue, placeholderPrefix, placeholderSuffix, trimValues, valueSeparator
      • 从类继承的字段 org.springframework.core.io.support.PropertiesLoaderSupport

        localOverride, localProperties, logger
      • 从接口继承的字段 org.springframework.core.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • 方法概要

      所有方法 静态方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      void destroy()
      Stop ConfigLoader listener and destroy proxy bean on spring container closing.
      protected void doLogLoadedProperties​(Properties props)
      log out loaded properties.
      For safety consider all value will print out only include partial string. example a result "key=jdbcpassword" will finally print out as "key=jdbcpa..."
      protected void doProcessProperties​(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactoryToProcess, org.springframework.util.StringValueResolver valueResolver)  
      static <T> T getFieldValue​(Object target, String fieldName, Class<T> returnType)  
      Map<String,​String> getProperties()
      Get all loaded properties.
      protected void loadProperties​(Properties props)  
      void onApplicationEvent​(org.springframework.context.ApplicationEvent event)
      listen all spring application event
      void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
      set ApplicationContext instance after it created in spring container.
      this method is call back by ApplicationContextAware interface.
      void setCallbackInteval​(long callbackInteval)
      set call back listen call back interval
      void setCcEnvId​(long ccEnvId)
      set environment id
      void setCcPassword​(String ccPassword)
      set password
      void setCcServerUrl​(String ccServerUrl)
      set server url
      void setCcVersion​(long ccVersion)
      set version
      void setCcVersionName​(String ccVersionName)
      set version name
      void setConnectionTimeout​(int connectionTimeout)
      set connection time out value
      void setEnableInterruptService​(boolean enableInterruptService)  
      void setEnableUpdateCallback​(boolean enableUpdateCallback)
      set enableUpdateCallback value
      void setEnvironment​(org.springframework.core.env.Environment environment)  
      void setEnvName​(String envName)
      set environment name
      void setLogProperties​(boolean logProperties)
      set logProperties
      void setProjectName​(String projectName)
      set project name
      void setReadTimeout​(int readTimeout)
      set read time out value
      • 从类继承的方法 org.springframework.context.support.PropertySourcesPlaceholderConfigurer

        getAppliedPropertySources, postProcessBeanFactory, processProperties, processProperties, setPropertySources
      • 从类继承的方法 org.springframework.beans.factory.config.PlaceholderConfigurerSupport

        setBeanFactory, setBeanName, setIgnoreUnresolvablePlaceholders, setNullValue, setPlaceholderPrefix, setPlaceholderSuffix, setTrimValues, setValueSeparator
      • 从类继承的方法 org.springframework.beans.factory.config.PropertyResourceConfigurer

        convertProperties, convertProperty, convertPropertyValue, getOrder, setOrder
      • 从类继承的方法 org.springframework.core.io.support.PropertiesLoaderSupport

        mergeProperties, setFileEncoding, setIgnoreResourceNotFound, setLocalOverride, setLocation, setLocations, setProperties, setPropertiesArray, setPropertiesPersister
    • 字段详细资料

      • RCC_PROPERTIES_PROPERTY_SOURCE_NAME

        public static final String RCC_PROPERTIES_PROPERTY_SOURCE_NAME
        rccProperties
        另请参阅:
        常量字段值
      • ccLoadedProps

        protected Properties ccLoadedProps
        local cached props load from configuration center
      • rccProperties

        protected Properties rccProperties
    • 构造器详细资料

      • ConfigCenterPropertyPlaceholderConfigurer

        public ConfigCenterPropertyPlaceholderConfigurer()
    • 方法详细资料

      • setProjectName

        public void setProjectName​(String projectName)
        set project name
        参数:
        projectName - the projectName to set
      • setEnvName

        public void setEnvName​(String envName)
        set environment name
        参数:
        envName - the envName to set
      • setEnvironment

        public void setEnvironment​(org.springframework.core.env.Environment environment)
        指定者:
        setEnvironment 在接口中 org.springframework.context.EnvironmentAware
        覆盖:
        setEnvironment 在类中 org.springframework.context.support.PropertySourcesPlaceholderConfigurer
      • setLogProperties

        public void setLogProperties​(boolean logProperties)
        set logProperties
        参数:
        logProperties - the logProperties to set
      • setCallbackInteval

        public void setCallbackInteval​(long callbackInteval)
        set call back listen call back interval
        参数:
        callbackInteval - the callbackInteval to set
      • setEnableInterruptService

        public void setEnableInterruptService​(boolean enableInterruptService)
      • setCcServerUrl

        public void setCcServerUrl​(String ccServerUrl)
        set server url
        参数:
        ccServerUrl - the ccServerUrl to set
      • setCcPassword

        public void setCcPassword​(String ccPassword)
        set password
        参数:
        ccPassword - the ccPassword to set
      • setCcVersion

        public void setCcVersion​(long ccVersion)
        set version
        参数:
        ccVersion - the ccVersion to set
      • setCcVersionName

        public void setCcVersionName​(String ccVersionName)
        set version name
        参数:
        ccVersionName - the ccVersionName to set
      • setCcEnvId

        public void setCcEnvId​(long ccEnvId)
        set environment id
        参数:
        ccEnvId - the ccEnvId to set
      • setReadTimeout

        public void setReadTimeout​(int readTimeout)
        set read time out value
        参数:
        readTimeout - the readTimeout to set
      • setConnectionTimeout

        public void setConnectionTimeout​(int connectionTimeout)
        set connection time out value
        参数:
        connectionTimeout - the connectionTimeout to set
      • setEnableUpdateCallback

        public void setEnableUpdateCallback​(boolean enableUpdateCallback)
        set enableUpdateCallback value
        参数:
        enableUpdateCallback - value
      • doProcessProperties

        protected void doProcessProperties​(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactoryToProcess,
                                           org.springframework.util.StringValueResolver valueResolver)
        覆盖:
        doProcessProperties 在类中 org.springframework.beans.factory.config.PlaceholderConfigurerSupport
      • doLogLoadedProperties

        protected void doLogLoadedProperties​(Properties props)
        log out loaded properties.
        For safety consider all value will print out only include partial string. example a result "key=jdbcpassword" will finally print out as "key=jdbcpa..."
        参数:
        props - properties to log out
      • loadProperties

        protected void loadProperties​(Properties props)
                               throws IOException
        覆盖:
        loadProperties 在类中 org.springframework.core.io.support.PropertiesLoaderSupport
        抛出:
        IOException
      • setApplicationContext

        public void setApplicationContext​(org.springframework.context.ApplicationContext applicationContext)
                                   throws org.springframework.beans.BeansException
        set ApplicationContext instance after it created in spring container.
        this method is call back by ApplicationContextAware interface.
        指定者:
        setApplicationContext 在接口中 org.springframework.context.ApplicationContextAware
        参数:
        applicationContext - spring application context instance
        抛出:
        org.springframework.beans.BeansException - bean create exception
      • destroy

        public void destroy()
                     throws Exception
        Stop ConfigLoader listener and destroy proxy bean on spring container closing.
        指定者:
        destroy 在接口中 org.springframework.beans.factory.DisposableBean
        抛出:
        Exception - throws any exception.
      • onApplicationEvent

        public void onApplicationEvent​(org.springframework.context.ApplicationEvent event)
        listen all spring application event
        指定者:
        onApplicationEvent 在接口中 org.springframework.context.ApplicationListener
        参数:
        event - spring application event
      • getProperties

        public Map<String,​String> getProperties()
        Get all loaded properties.
        返回:
        loaded properties