Created
January 17, 2023 19:32
-
-
Save rajeevshukla/3cb42011fa395d98c91d8cea66321d7e to your computer and use it in GitHub Desktop.
Environment post processor
This file contains 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 characters
@Configuration | |
public class DevProfileEnvironmentPostProcessor implements EnvironmentPostProcessor { | |
@Override | |
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { | |
if (environment.acceptsProfiles("dev")) { | |
Map<String, Object> devProperties = new HashMap<>(); | |
devProperties.put("server.port", 8080); | |
devProperties.put("logging.level.org.springframework.web", "DEBUG"); | |
devProperties.put("logging.level.com.example.application", "TRACE"); | |
environment.getPropertySources().addFirst(new MapPropertySource("devProperties", devProperties)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment