Skip to content

Commit

Permalink
fix refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
shedfreez committed Nov 19, 2024
1 parent 21fb6b5 commit 5bd61a2
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class PolarisConfigFileLocator implements PropertySourceLocator {
// this class provides customized logic for some customers to configure special business group files
private final PolarisConfigCustomExtensionLayer polarisConfigCustomExtensionLayer = PolarisServiceLoaderUtil.getPolarisConfigCustomExtensionLayer();

private volatile static CompositePropertySource compositePropertySourceCache = null;

public PolarisConfigFileLocator(PolarisConfigProperties polarisConfigProperties,
PolarisContextProperties polarisContextProperties, ConfigFileService configFileService, Environment environment) {
this.polarisConfigProperties = polarisConfigProperties;
Expand All @@ -85,7 +87,12 @@ public PolarisConfigFileLocator(PolarisConfigProperties polarisConfigProperties,
@Override
public PropertySource<?> locate(Environment environment) {
if (polarisConfigProperties.isEnabled()) {
// use cache when refreshing context
if (compositePropertySourceCache != null) {
return compositePropertySourceCache;
}
CompositePropertySource compositePropertySource = new CompositePropertySource(POLARIS_CONFIG_PROPERTY_SOURCE_NAME);
compositePropertySourceCache = compositePropertySource;
try {
// load custom config extension files
initCustomPolarisConfigExtensionFiles(compositePropertySource);
Expand Down

0 comments on commit 5bd61a2

Please sign in to comment.