|
|
@ -29,6 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
import com.tencent.polaris.api.utils.MapUtils;
|
|
|
|
import com.tencent.polaris.api.utils.MapUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
import org.springframework.beans.BeansException;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationPropertiesBean;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationPropertiesBean;
|
|
|
|
import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
|
|
|
|
import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
|
|
|
@ -112,7 +113,8 @@ public class AffectedConfigurationPropertiesRebinder extends ConfigurationProper
|
|
|
|
assert field != null;
|
|
|
|
assert field != null;
|
|
|
|
field.setAccessible(true);
|
|
|
|
field.setAccessible(true);
|
|
|
|
field.set(bean, defaultValues.get(fieldName));
|
|
|
|
field.set(bean, defaultValues.get(fieldName));
|
|
|
|
} catch (Exception e){
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception e) {
|
|
|
|
LOGGER.error("[SCT Config] rebind default value error, bean = {}, key = {}", beanName, key);
|
|
|
|
LOGGER.error("[SCT Config] rebind default value error, bean = {}, key = {}", beanName, key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -130,12 +132,16 @@ public class AffectedConfigurationPropertiesRebinder extends ConfigurationProper
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
field.setAccessible(true);
|
|
|
|
field.setAccessible(true);
|
|
|
|
defaultValues.put(field.getName(), field.get(instance));
|
|
|
|
defaultValues.put(field.getName(), field.get(instance));
|
|
|
|
} catch (Exception ignored){}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ignored) {
|
|
|
|
|
|
|
|
}
|
|
|
|
}, field -> {
|
|
|
|
}, field -> {
|
|
|
|
int modifiers = field.getModifiers();
|
|
|
|
int modifiers = field.getModifiers();
|
|
|
|
return !Modifier.isFinal(modifiers) && !Modifier.isStatic(modifiers);
|
|
|
|
return !Modifier.isFinal(modifiers) && !Modifier.isStatic(modifiers);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}catch (Exception ignored){}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception ignored) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
propertiesBeanDefaultValues.put(propertiesBean.getName(), defaultValues);
|
|
|
|
propertiesBeanDefaultValues.put(propertiesBean.getName(), defaultValues);
|
|
|
|
}
|
|
|
|
}
|
|
|
|