|
28 | 28 | import org.apache.commons.logging.LogFactory;
|
29 | 29 |
|
30 | 30 | import org.springframework.boot.ansi.AnsiPropertySource;
|
| 31 | +import org.springframework.core.env.ConfigurableEnvironment; |
31 | 32 | import org.springframework.core.env.Environment;
|
32 | 33 | import org.springframework.core.env.MapPropertySource;
|
33 | 34 | import org.springframework.core.env.MutablePropertySources;
|
34 | 35 | import org.springframework.core.env.PropertyResolver;
|
35 |
| -import org.springframework.core.env.PropertySource; |
36 | 36 | import org.springframework.core.env.PropertySourcesPropertyResolver;
|
37 | 37 | import org.springframework.core.io.Resource;
|
38 | 38 | import org.springframework.core.log.LogMessage;
|
@@ -79,22 +79,15 @@ public void printBanner(Environment environment, Class<?> sourceClass, PrintStre
|
79 | 79 |
|
80 | 80 | protected List<PropertyResolver> getPropertyResolvers(Environment environment, Class<?> sourceClass) {
|
81 | 81 | MutablePropertySources propertySources = new MutablePropertySources();
|
82 |
| - propertySources.addLast(getEnvironmentSource(environment)); |
| 82 | + if (environment instanceof ConfigurableEnvironment) { |
| 83 | + ((ConfigurableEnvironment) environment).getPropertySources().forEach(propertySources::addLast); |
| 84 | + } |
83 | 85 | propertySources.addLast(getTitleSource(sourceClass));
|
84 | 86 | propertySources.addLast(getAnsiSource());
|
85 | 87 | propertySources.addLast(getVersionSource(sourceClass));
|
86 | 88 | return Collections.singletonList(new PropertySourcesPropertyResolver(propertySources));
|
87 | 89 | }
|
88 | 90 |
|
89 |
| - private PropertySource<Environment> getEnvironmentSource(Environment environment) { |
90 |
| - return new PropertySource<Environment>("environment", environment) { |
91 |
| - @Override |
92 |
| - public Object getProperty(String name) { |
93 |
| - return environment.getProperty(name); |
94 |
| - } |
95 |
| - }; |
96 |
| - } |
97 |
| - |
98 | 91 | private MapPropertySource getVersionSource(Class<?> sourceClass) {
|
99 | 92 | return new MapPropertySource("version", getVersionsMap(sourceClass));
|
100 | 93 | }
|
|
0 commit comments