Is there a way programmatically to get the current active profile within my bean?
This question is related to
java
spring
spring-boot
It doesn't matter is your app Boot or just raw Spring. There is just enough to inject org.springframework.core.env.Environment
to your bean.
@Autowired
private Environment environment;
....
this.environment.getActiveProfiles();
Source: Stackoverflow.com