When in production, when I fall into an exception, send an email to the support but only in production, in development I do not want it to perform this task.
When in production, when I fall into an exception, send an email to the support but only in production, in development I do not want it to perform this task.
The solution was to inject a spring boot class called Environment.
@Autowired
private Environment environment;
environment.getActiveProfiles()[0].equals("production"));
Application.properties file
#ENVIRONMENT
spring.profiles.active=develop