Posts

Showing posts with the label SPRING BOOT

Spring boot - Conditional Bean Creation

@ConditionalOnBean(name = "otherNeededBean") The bean is only created, if the bean "otherNeededBean" already exist. @ConditionalOnMissingBean The bean is only created, if no other bean with the same name already exist. @ConditionalOnMissingBean(type = "alternativeBean") The bean is only created, if bean "alternativeBean" doesn't exist. Conditional based on Environment property Add proprty file to the Configuration class. @PropertySource("classpath:myspecific.properties") public class MySpecificConfiguration {} @ConditionalOnProperty(name = "email.notification", havingValue = "true") @Bean public MailService ... myspecific.properties: email.notification = true | false

Spring Boot / Swagger / Prometheus / Grafana

Simple (H2) CRUD application demonstrating Spring Boot  Swagger Prometheus Grafana https://dzone.com/articles/monitoring-using-spring-boot-2-prometheus-amp-graf List of Spring Metrics: https://docs.spring.io/spring-metrics/docs/current/public/prometheus