From e412d859a3897ef9b3bcc459eff9fcef4940dc3e Mon Sep 17 00:00:00 2001 From: pvannierop Date: Fri, 4 Oct 2024 09:49:46 +0200 Subject: [PATCH] Disable mail autoconfiguration when not sending notifications via email --- .../config/MailAutoconfigureExcludeConfig.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/main/java/org/radarbase/appserver/config/MailAutoconfigureExcludeConfig.java diff --git a/src/main/java/org/radarbase/appserver/config/MailAutoconfigureExcludeConfig.java b/src/main/java/org/radarbase/appserver/config/MailAutoconfigureExcludeConfig.java new file mode 100644 index 00000000..b5ef9632 --- /dev/null +++ b/src/main/java/org/radarbase/appserver/config/MailAutoconfigureExcludeConfig.java @@ -0,0 +1,13 @@ +package org.radarbase.appserver.config; + +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConditionalOnProperty(value = "radar.notification.email.enabled", havingValue = "false", matchIfMissing = true) +@EnableAutoConfiguration(exclude = { + org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration.class, + org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration.class +}) +public class MailAutoconfigureExcludeConfig { }