public static void convertPropertySources(InterceptionMode interceptionMode, EncryptablePropertyResolver propertyResolver, EncryptablePropertyFilter propertyFilter, MutablePropertySources propSources) { StreamSupport.stream(propSources.spliterator(), false) .filter(ps -> !(ps instanceof EncryptablePropertySource)) .map(ps -> makeEncryptable(interceptionMode, propertyResolver, propertyFilter, ps)) .collect(toList()) .forEach(ps -> propSources.replace(ps.getName(), ps)); }
/** * config log settings */ private void assemblyLogSetting(ConfigurableEnvironment environment) { StreamSupport.stream(environment.getPropertySources().spliterator(), false) .filter(propertySource -> propertySource instanceof EnumerablePropertySource) .map(propertySource -> Arrays .asList(((MapPropertySource) propertySource).getPropertyNames())) .flatMap(Collection::stream).filter(LogEnvUtils::filterAllLogConfig) .forEach((key) -> HIGH_PRIORITY_CONFIG.getSource().put(key, environment.getProperty(key))); }
public static void convertPropertySources(InterceptionMode interceptionMode, EncryptablePropertyResolver propertyResolver, EncryptablePropertyFilter propertyFilter, MutablePropertySources propSources) { StreamSupport.stream(propSources.spliterator(), false) .filter(ps -> !(ps instanceof EncryptablePropertySource)) .map(ps -> makeEncryptable(interceptionMode, propertyResolver, propertyFilter, ps)) .collect(toList()) .forEach(ps -> propSources.replace(ps.getName(), ps)); }
@SuppressWarnings("rawtypes") @EventListener public void handleContextRefresh(ContextRefreshedEvent event) { final Environment env = event.getApplicationContext().getEnvironment(); log.trace("====== Environment and configuration ======"); log.trace("Active profiles: {}", Arrays.toString(env.getActiveProfiles())); final MutablePropertySources sources = ((AbstractEnvironment) env).getPropertySources(); StreamSupport.stream(sources.spliterator(), false).filter(ps -> ps instanceof EnumerablePropertySource) .map(ps -> ((EnumerablePropertySource) ps).getPropertyNames()).flatMap(Arrays::stream).distinct() .filter(prop -> !(prop.contains("credentials") || prop.contains("password"))) .forEach(prop -> log.trace("{}: {}", prop, env.getProperty(prop))); log.trace("==========================================="); }
if (SOFABootEnvUtils.isSpringCloud() && executed.compareAndSet(false, true)) { StandardEnvironment bootstrapEnvironment = new StandardEnvironment(); StreamSupport.stream(environment.getPropertySources().spliterator(), false) .filter(source->!(source instanceof PropertySource.StubPropertySource)) .forEach(source -> bootstrapEnvironment.getPropertySources().addLast(source));