-
-
Save m-cakir/9358a1df7da9d82abf2b847ae6ec75bd to your computer and use it in GitHub Desktop.
Revisions
-
sandor-nemeth revised this gist
May 19, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ package io.github.sandornemeth.spring; import java.util.Arrays; import java.util.stream.StreamSupport; -
sandor-nemeth revised this gist
Jan 17, 2018 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,6 @@ package de.idealo.ecommerce.order.history.config; import java.util.Arrays; import java.util.stream.StreamSupport; import org.slf4j.Logger; -
sandor-nemeth created this gist
Jan 17, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ package de.idealo.ecommerce.order.history.config; import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.StreamSupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.EventListener; import org.springframework.core.env.AbstractEnvironment; import org.springframework.core.env.EnumerablePropertySource; import org.springframework.core.env.Environment; import org.springframework.core.env.MutablePropertySources; import org.springframework.stereotype.Component; @Component public class PropertyLogger { private static final Logger LOGGER = LoggerFactory.getLogger(PropertyLogger.class); @EventListener public void handleContextRefresh(ContextRefreshedEvent event) { final Environment env = event.getApplicationContext().getEnvironment(); LOGGER.info("====== Environment and configuration ======"); LOGGER.info("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 -> LOGGER.info("{}: {}", prop, env.getProperty(prop))); LOGGER.info("==========================================="); } }