Browse Source

Show loaded property sources during Spring initialization

Signed-off-by: Pekka Helenius <fincer89@hotmail.com>
v0.0.3-alpha
Pekka Helenius 4 years ago
parent
commit
9d4724829a
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      bookstore/src/main/java/com/fjordtek/bookstore/config/AdditionalPropertiesConfig.java

+ 10
- 0
bookstore/src/main/java/com/fjordtek/bookstore/config/AdditionalPropertiesConfig.java View File

@ -12,6 +12,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
@ -42,6 +43,14 @@ public class AdditionalPropertiesConfig implements EnvironmentPostProcessor {
return resources;
}
private void showSpringConfiguration(MutablePropertySources properties) {
System.out.print("** Used Spring property sources **\n\n");
for (PropertySource<?> source : properties) {
System.out.println(source.toString());
}
}
@Override
public void postProcessEnvironment(
ConfigurableEnvironment environment,
@ -63,6 +72,7 @@ public class AdditionalPropertiesConfig implements EnvironmentPostProcessor {
}
}
showSpringConfiguration(propertySources);
}
}


Loading…
Cancel
Save