国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

Spring Boot Admin郵件警報整合過程解析

瀏覽:5日期:2023-09-13 11:09:14

一、前言

在Spring Boot Admin Server 中撒送預警郵件通知是很簡單的,只需要簡單的幾個配置就可以了。

二、代碼演示

1、microservice-monitor-server-> pom.xml

<?xml version='1.0' encoding='UTF-8'?><project xmlns='http://maven.apache.org/POM/4.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd'> <parent> <artifactId>microservice-minitor</artifactId> <groupId>com.microservice</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>microservice-monitor-server</artifactId> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-server</artifactId> <version>2.2.0</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> </dependencies> <build> <plugins> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build></project>

其中改動的只是添加了spring-boot-starter-mail 的依賴

2、microservice-monitor-server-> application.yml

server: port: 8888spring: 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: trueeureka: 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的代碼,只需簡單的配置就可以了。

三、運行測試

Spring Boot Admin郵件警報整合過程解析

Spring Boot Admin郵件警報整合過程解析

能夠正常的發送接收郵件!

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: Spring
相關文章:
主站蜘蛛池模板: 嫩江县| 克拉玛依市| 洛扎县| 阿鲁科尔沁旗| 合阳县| 吉木乃县| 若羌县| 嘉兴市| 德阳市| 临桂县| 霸州市| 沙坪坝区| 秦安县| 新宾| 福泉市| 革吉县| 响水县| 舟山市| 新化县| 渝中区| 甘谷县| 常宁市| 阳江市| 南康市| 根河市| 江陵县| 镇坪县| 宣城市| 鱼台县| 隆回县| 台前县| 青冈县| 儋州市| 五寨县| 许昌县| 雅江县| 宁河县| 扎囊县| 米林县| 龙井市| 醴陵市|