Skip to content

Commit

Permalink
chore(messaging/mail): 优化邮件配置服务命名
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Jun 30, 2024
1 parent 7bc25b2 commit 3e4b6ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import top.continew.starter.core.util.validate.ValidationUtils;

/**
* 邮件配置服务
* 邮件配置
*
* @author Charles7c
* @since 2.1.0
*/
public interface MailConfigService {
public interface MailConfigurer {

/**
* 获取邮件配置
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.springframework.mail.javamail.MimeMessageHelper;
import top.continew.starter.core.constant.StringConstants;
import top.continew.starter.core.util.ExceptionUtils;
import top.continew.starter.messaging.mail.core.MailConfigService;
import top.continew.starter.messaging.mail.core.MailConfigurer;

import java.io.File;
import java.nio.charset.StandardCharsets;
Expand Down Expand Up @@ -217,10 +217,9 @@ private static List<String> splitAddress(String addresses) {
*/
public static JavaMailSenderImpl getMailSender() {
JavaMailSenderImpl mailSender = SpringUtil.getBean(JavaMailSenderImpl.class);
MailConfigService mailConfigService = ExceptionUtils.exToNull(() -> SpringUtil
.getBean(MailConfigService.class));
if (mailConfigService != null && mailConfigService.getMailConfig() != null) {
mailConfigService.apply(mailConfigService.getMailConfig(), mailSender);
MailConfigurer mailConfigurer = ExceptionUtils.exToNull(() -> SpringUtil.getBean(MailConfigurer.class));
if (mailConfigurer != null && mailConfigurer.getMailConfig() != null) {
mailConfigurer.apply(mailConfigurer.getMailConfig(), mailSender);
}
return mailSender;
}
Expand Down

0 comments on commit 3e4b6ab

Please sign in to comment.