Skip to content

Commit 6533e0c

Browse files
committed
Makes ContextRefresher easier to extend.
Adds protected getters for context and scope. Adds new refreshEnvironment() method. fixes spring-projectsgh-382
1 parent 69181c1 commit 6533e0c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

spring-cloud-context/src/main/java/org/springframework/cloud/context/refresh/ContextRefresher.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,27 @@ public ContextRefresher(ConfigurableApplicationContext context, RefreshScope sco
5656
this.scope = scope;
5757
}
5858

59+
protected ConfigurableApplicationContext getContext() {
60+
return this.context;
61+
}
62+
63+
protected RefreshScope getScope() {
64+
return this.scope;
65+
}
66+
5967
public synchronized Set<String> refresh() {
68+
Set<String> keys = refreshEnvironment();
69+
this.scope.refreshAll();
70+
return keys;
71+
}
72+
73+
public synchronized Set<String> refreshEnvironment() {
6074
Map<String, Object> before = extract(
6175
this.context.getEnvironment().getPropertySources());
6276
addConfigFilesToEnvironment();
6377
Set<String> keys = changes(before,
6478
extract(this.context.getEnvironment().getPropertySources())).keySet();
6579
this.context.publishEvent(new EnvironmentChangeEvent(context, keys));
66-
this.scope.refreshAll();
6780
return keys;
6881
}
6982

0 commit comments

Comments
 (0)