58
58
@ AutoConfigureAfter (EndpointAutoConfiguration .class )
59
59
public class RefreshEndpointAutoConfiguration {
60
60
61
- @ ConditionalOnBean (EndpointAutoConfiguration .class )
62
- @ ConditionalOnMissingClass ("org.springframework.boot.actuate.info.InfoContributor" )
63
- @ Bean
64
- InfoEndpointRebinderConfiguration infoEndpointRebinderConfiguration () {
65
- return new InfoEndpointRebinderConfiguration ();
66
- }
67
-
68
61
@ ConditionalOnMissingBean
69
62
@ ConditionalOnEnabledHealthIndicator ("refresh" )
70
63
@ Bean
@@ -133,52 +126,4 @@ public RefreshEventListener refreshEventListener(
133
126
}
134
127
135
128
}
136
-
137
- private static class InfoEndpointRebinderConfiguration
138
- implements ApplicationListener <EnvironmentChangeEvent >, BeanPostProcessor {
139
-
140
- @ Autowired
141
- private ConfigurableEnvironment environment ;
142
-
143
- private Map <String , Object > map = new LinkedHashMap <String , Object >();
144
-
145
- @ Override
146
- public void onApplicationEvent (EnvironmentChangeEvent event ) {
147
- for (String key : event .getKeys ()) {
148
- if (key .startsWith ("info." )) {
149
- this .map .put (key .substring ("info." .length ()),
150
- this .environment .getProperty (key ));
151
- }
152
- }
153
- }
154
-
155
- @ Override
156
- public Object postProcessAfterInitialization (Object bean , String beanName )
157
- throws BeansException {
158
- if (bean instanceof InfoEndpoint ) {
159
- return infoEndpoint ((InfoEndpoint ) bean );
160
- }
161
- return bean ;
162
- }
163
-
164
- @ Override
165
- public Object postProcessBeforeInitialization (Object bean , String beanName )
166
- throws BeansException {
167
- return bean ;
168
- }
169
-
170
- private InfoEndpoint infoEndpoint (InfoEndpoint endpoint ) {
171
- return new InfoEndpoint (endpoint .invoke ()) {
172
- @ Override
173
- public Map <String , Object > invoke () {
174
- Map <String , Object > info = new LinkedHashMap <String , Object >(
175
- super .invoke ());
176
- info .putAll (InfoEndpointRebinderConfiguration .this .map );
177
- return info ;
178
- }
179
- };
180
- }
181
-
182
- }
183
-
184
129
}
0 commit comments