this.propertySourceMap = propertySourceMap;
}
@Override
public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
MutablePropertySources propertySources = event.getEnvironment().getPropertySources();
if (propertySources.contains(CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME)) {
if(log.isDebugEnabled()) {
log.debug("Adding afterCommandLineArgs property source after "
+ CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME);
}
propertySources.addAfter(CommandLinePropertySource.COMMAND_LINE_PROPERTY_SOURCE_NAME,
new MapPropertySource("afterCommandLineArgs", propertySourceMap));
} else {
if(log.isDebugEnabled()) {
log.debug("Adding afterCommandLineArgs property source as first");
}
propertySources.addFirst(new MapPropertySource("afterCommandLineArgs", propertySourceMap));
}
}