feature:add @ConditionalOnConfigReflectEnabled annotation

pull/496/head
wulingxiao 3 years ago
parent 90d6d18c1b
commit c4605d835e

@ -21,6 +21,9 @@ package com.tencent.cloud.polaris.config.adapter;
import java.util.Set; import java.util.Set;
/** /**
* PolarisPropertySourceRefresher refresh spring value filed and configurationProperties bean
* when config exchange.
*
* @author lingxiao.wlx * @author lingxiao.wlx
*/ */
public interface PolarisPropertySourceRefresher { public interface PolarisPropertySourceRefresher {
@ -34,6 +37,7 @@ public interface PolarisPropertySourceRefresher {
/** /**
* refresh @ConfigurationProperties beans. * refresh @ConfigurationProperties beans.
*
* @param changeKeys changeKeys * @param changeKeys changeKeys
*/ */
void refreshConfigurationProperties(Set<String> changeKeys); void refreshConfigurationProperties(Set<String> changeKeys);

@ -38,6 +38,9 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
/** /**
* PolarisReflectPropertySourceAutoRefresher to refresh config in reflect type
* we can use it by setting spring.cloud.polaris.config.refresh-type=reflect.
*
* @author lingxiao.wlx * @author lingxiao.wlx
*/ */
public class PolarisReflectPropertySourceAutoRefresher extends PolarisPropertySourceAutoRefresher public class PolarisReflectPropertySourceAutoRefresher extends PolarisPropertySourceAutoRefresher

@ -25,6 +25,8 @@ import com.tencent.cloud.polaris.config.config.PolarisConfigProperties;
import org.springframework.cloud.context.refresh.ContextRefresher; import org.springframework.cloud.context.refresh.ContextRefresher;
/** /**
* PolarisRefreshContextPropertySourceAutoRefresher refresh config by refreshContext.
*
* @author lingxiao.wlx * @author lingxiao.wlx
*/ */
public class PolarisRefreshContextPropertySourceAutoRefresher extends PolarisPropertySourceAutoRefresher { public class PolarisRefreshContextPropertySourceAutoRefresher extends PolarisPropertySourceAutoRefresher {
@ -40,6 +42,7 @@ public class PolarisRefreshContextPropertySourceAutoRefresher extends PolarisPro
@Override @Override
public void refreshSpringValue(String changedKey) { public void refreshSpringValue(String changedKey) {
// do nothing,all config will be refreshed by contextRefresher.refresh
} }
@Override @Override

@ -26,6 +26,8 @@ import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata; import org.springframework.core.type.AnnotatedTypeMetadata;
/** /**
* ConfigReflectCondition used by {@link ConditionalOnConfigReflectEnabled}.
*
* @author lingxiao.wlx * @author lingxiao.wlx
*/ */
public class ConfigReflectCondition extends SpringBootCondition { public class ConfigReflectCondition extends SpringBootCondition {

Loading…
Cancel
Save