mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-04-17 05:43:39 +00:00
feat: 重构模块
This commit is contained in:
@@ -7,8 +7,7 @@ import org.ruoyi.common.core.service.ConfigService;
|
||||
import org.ruoyi.common.mail.utils.MailAccount;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
|
||||
/**
|
||||
* JavaMail 配置
|
||||
@@ -22,10 +21,9 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
public class MailConfig {
|
||||
|
||||
private final ConfigService configService;
|
||||
private MailAccount account; // 缓存MailAccount实例
|
||||
private MailAccount account;
|
||||
|
||||
@Bean
|
||||
@Scope("singleton")
|
||||
public MailAccount mailAccount() {
|
||||
if (account == null) {
|
||||
account = new MailAccount();
|
||||
@@ -34,7 +32,6 @@ public class MailConfig {
|
||||
return account;
|
||||
}
|
||||
|
||||
@Scheduled(fixedDelay = 10000) // 每10秒检查一次
|
||||
public void updateMailAccount() {
|
||||
account.setHost(getKey("host"));
|
||||
account.setPort(NumberUtils.toInt(getKey("port"), 465));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package org.ruoyi.common.mail.config.properties;
|
||||
package org.ruoyi.common.mail.properties;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
Reference in New Issue
Block a user