List of usage examples for org.springframework.core.env StandardEnvironment getProperty
@Override
@Nullable
public String getProperty(String key)
From source file:org.wallride.autoconfigure.WallRideInitializer.java
public static ConfigurableEnvironment createEnvironment(ApplicationStartedEvent event) { StandardEnvironment environment = new StandardEnvironment(); String home = environment.getProperty(WallRideProperties.HOME_PROPERTY); if (!StringUtils.hasText(home)) { throw new IllegalStateException(WallRideProperties.HOME_PROPERTY + " is empty"); }/*ww w. j av a 2 s. co m*/ if (!home.endsWith("/")) { home = home + "/"; } String config = home + WallRideProperties.DEFAULT_CONFIG_PATH_NAME; String media = home + WallRideProperties.DEFAULT_MEDIA_PATH_NAME; System.setProperty(WallRideProperties.CONFIG_LOCATION_PROPERTY, config); System.setProperty(WallRideProperties.MEDIA_LOCATION_PROPERTY, media); event.getSpringApplication().getListeners().stream() .filter(listener -> listener.getClass().isAssignableFrom(ConfigFileApplicationListener.class)) .map(listener -> (ConfigFileApplicationListener) listener) .forEach(listener -> listener.setSearchLocations(DEFAULT_CONFIG_SEARCH_LOCATIONS + "," + config)); return environment; }