起因:
服务器 http://172.22.76.69:8083/actuator/health
等待很久才响应 {"status":"DOWN"}
本地 http://localhost:8083/actuator/health
{"status":"UP"}
分析:
看表象,应该是网络问题
查看服务器日志,无错误。很奇怪,先把测试环境的日志级别调制DEBUG级别。
等待一会提示信息如:
MailHealthIndicator javax.mail.MessagingException: Could not connect to SMTP host: smtp.qiye.aliyun.com, port: 25, response: -1
疑问:
邮件配置有问题?
为什么还是25端口?
原配置:
spring: mail: default-encoding: UTF-8 # 字符集 host: smtp.qiye.aliyun.com protocol: smtp #协议 properties: ssl: true smtpPort: 465 set-to:
debug排查
SMTPTransport
if (!isSSL) isSSL = PropUtil.getBooleanProperty(props, "mail." + name + ".ssl.enable", false); if (isSSL) this.defaultPort = 465; else this.defaultPort = 25; this.isSSL = isSSL;
修改了配置即可
srring: mail: default-encoding: UTF-8 # 字符集 host: smtp.qiye.aliyun.com protocol: smtp #协议 port: 465 properties: mail: smtp: ssl: enable: true