Move code from spring-boot-actuator to spring-boot-mail

This commit is contained in:
Andy Wilkinson
2025-05-12 09:43:42 +01:00
committed by Phillip Webb
parent 29b745215e
commit 048cc5a6da
6 changed files with 18 additions and 12 deletions

View File

@@ -20,12 +20,12 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.health.HealthContributor;
import org.springframework.boot.actuate.mail.MailHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.mail.actuate.health.MailHealthIndicator;
import org.springframework.boot.mail.autoconfigure.MailSenderAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.mail.javamail.JavaMailSenderImpl;
@@ -37,7 +37,7 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
* @since 2.0.0
*/
@AutoConfiguration(after = MailSenderAutoConfiguration.class)
@ConditionalOnClass(JavaMailSenderImpl.class)
@ConditionalOnClass({ JavaMailSenderImpl.class, MailHealthIndicator.class })
@ConditionalOnBean(JavaMailSenderImpl.class)
@ConditionalOnEnabledHealthIndicator("mail")
public class MailHealthContributorAutoConfiguration

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,8 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.mail;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.health.HealthContributorAutoConfiguration;
import org.springframework.boot.actuate.mail.MailHealthIndicator;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.mail.actuate.health.MailHealthIndicator;
import org.springframework.boot.mail.autoconfigure.MailSenderAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

View File

@@ -14,6 +14,9 @@ dependencies {
api("org.springframework:spring-context-support")
api("org.eclipse.angus:jakarta.mail")
compileOnly("com.fasterxml.jackson.core:jackson-annotations")
optional(project(":spring-boot-project:spring-boot-actuator"))
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
dockerTestImplementation(project(":spring-boot-project:spring-boot-test"))
@@ -21,8 +24,11 @@ dependencies {
dockerTestImplementation("org.testcontainers:testcontainers")
dockerTestImplementation("org.testcontainers:junit-jupiter")
testCompileOnly("com.fasterxml.jackson.core:jackson-annotations")
testImplementation(project(":spring-boot-project:spring-boot-test"))
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
testRuntimeOnly("ch.qos.logback:logback-classic")
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.mail;
package org.springframework.boot.mail.actuate.health;
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
import org.springframework.boot.actuate.health.Health.Builder;
@@ -27,7 +27,7 @@ import org.springframework.util.StringUtils;
*
* @author Johannes Edmeier
* @author Scott Frederick
* @since 2.0.0
* @since 4.0.0
*/
public class MailHealthIndicator extends AbstractHealthIndicator {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,6 @@
*/
/**
* Actuator support for JavaMail.
* Health integration for JavaMail.
*/
package org.springframework.boot.actuate.mail;
package org.springframework.boot.mail.actuate.health;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2023 the original author or authors.
* Copyright 2012-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.mail;
package org.springframework.boot.mail.actuate.health;
import java.util.Properties;