这篇文章主要介绍了Spring Boot Admin邮件警报整合过程的示例分析,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

一、前言
在Spring Boot Admin Server 中撒送预警邮件通知是很简单的,只需要简单的几个配置就可以了。
二、代码演示
1、microservice-monitor-server-> pom.xml
microservice-minitor com.microservice 1.0-SNAPSHOT 4.0.0 microservice-monitor-server org.springframework.boot spring-boot-starter-web de.codecentric spring-boot-admin-starter-server 2.2.0 org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-security org.springframework.boot spring-boot-starter-mail org.springframework.boot spring-boot-maven-plugin
其中改动的只是添加了spring-boot-starter-mail 的依赖
2、microservice-monitor-server-> application.yml
server:
port: 8888
spring:
application:
name: SpringBootAdmin
boot:
admin:
ui:
title: SpringBootAdmin-Server
notify:
mail:
from: 123@qq.com
to: 345@outlook.com
security:
user:
name: "admin"
password: "admin"
mail:
host: smtp.qq.com
username: 123@qq.com
password: qq #授权码
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
eureka:
instance:
hostname: localhost
metadata-map:
user.name: ${spring.security.user.name}
user.password: ${spring.security.user.password}
client:
register-with-eureka: true
fetch-registry: true
serviceUrl:
defaultZone: http://localhost:8001/register/eureka/只需要两步就配置完成,根本就没有编写任何的Java的代码,只需简单的配置就可以了。
三、运行测试


能够正常的发送接收邮件!
springboot是什么
springboot一种全新的编程规范,其设计目的是用来简化新Spring应用的初始搭建以及开发过程,SpringBoot也是一个服务于框架的框架,服务范围是简化配置文件。
感谢你能够认真阅读完这篇文章,希望小编分享的“Spring Boot Admin邮件警报整合过程的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持创新互联建站,关注创新互联网站建设公司行业资讯频道,更多相关知识等着你来学习!
另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
名称栏目:SpringBootAdmin邮件警报整合过程的示例分析-创新互联
分享地址:http://www.scyingshan.cn/article/ppdos.html


咨询
建站咨询
