import org.springframework.boot.SpringApplication;
import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.PropertySource;
import java.util.Arrays;
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
- String sites = null;
- for (PropertySource source : environment.getPropertySources()) {
- Object found = source.getProperty("juplo.sites");
- if (found != null)
- sites = found.toString();
- }
-
- if (sites == null)
- throw new IllegalArgumentException("Parameter juplo.sites is not set!");
+ String sites = environment.getRequiredProperty("juplo.sites", String.class);
application.addInitializers(new MultipleBeansApplicationContextInitializer(
Arrays.stream(sites.split(","))