@Override public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { addPropertySources(environment, application.getResourceLoader()); }
private ResourceLoader getResourceLoader(SpringApplication application) { ResourceLoader resourceLoader = application.getResourceLoader(); if (resourceLoader == null) { resourceLoader = new DefaultResourceLoader(application.getClassLoader()); } return resourceLoader; }
private ResourceLoader getResourceLoader(SpringApplication application) { ResourceLoader resourceLoader = application.getResourceLoader(); if (resourceLoader == null) { resourceLoader = new DefaultResourceLoader(application.getClassLoader()); } return resourceLoader; }
@Override public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { new Loader(environment, application.getResourceLoader()).load(); }
@Override public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { ResourceLoader resourceLoader = application.getResourceLoader(); if (resourceLoader == null) { resourceLoader = new DefaultResourceLoader(); } MutablePropertySources propertySources = environment.getPropertySources(); for (String location : DEPRECATED_LOCATIONS) { try { Resource resource = resourceLoader.getResource(location); PropertySource<?> propertySource = DEFAULT_PROPERTY_SOURCE_FACTORY.createPropertySource(null, new EncodedResource(resource)); if (propertySources.contains(propertySource.getName())) { propertySources.replace(propertySource.getName(), propertySource); } else { propertySources.addLast(propertySource); } logger.warn("Using deprecated property source {} please switch to using Spring Boot externalized configuration", propertySource); } catch (IllegalArgumentException | FileNotFoundException | UnknownHostException ex) { // We are always ignoring the deprecated resources. This is done in the same way as in the Spring ConfigurationClassParsers // Placeholders not resolvable or resource not found when trying to open it if (logger.isInfoEnabled()) { logger.info("Properties location [{}] not resolvable: {}", location, ex.getMessage()); } } catch (IOException ex) { throw new UncheckedIOException("Failed to creaty property source", ex); } } }
setActiveProfiles(environment, config.getActiveProfiles()); ResourceLoader resourceLoader = (application.getResourceLoader() != null) ? application.getResourceLoader() : new DefaultResourceLoader(getClass().getClassLoader()); TestPropertySourceUtils.addPropertiesFilesToEnvironment(environment,