From 92f030887b45604744d488131a506abbda14b4b5 Mon Sep 17 00:00:00 2001 From: zlyx <1242874891@qq.com> Date: 星期一, 02 五月 2022 21:21:14 +0800 Subject: [PATCH] [add]: 1. (common) pom.xml - 增加邮件依赖 ; 2. (admin) application-dev.yml - 增加邮件配置 ; 3. (framework) MailProperties, MailConfig - 增加邮件属性配置 ; 4. (common) MailUtils - 重写 Hutool MailUtil方法 ; 5. (demo) MailController - 邮件发送测试方法 ; --- ruoyi-admin/src/main/resources/application-dev.yml | 164 ++++++++++++++++++++++++++++++++---------------------- 1 files changed, 98 insertions(+), 66 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index ba38be6..50e060b 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -1,41 +1,34 @@ ---- # 鐩戞帶閰嶇疆 -spring: - boot: - admin: - # Spring Boot Admin Client 瀹㈡埛绔殑鐩稿叧閰嶇疆 - client: - # 澧炲姞瀹㈡埛绔紑鍏� - enabled: true - # 璁剧疆 Spring Boot Admin Server 鍦板潃 - url: http://localhost:9090/admin - instance: - service-host-type: IP - username: ruoyi - password: 123456 +--- # 鐩戞帶涓績閰嶇疆 +spring.boot.admin.client: + # 澧炲姞瀹㈡埛绔紑鍏� + enabled: true + url: http://localhost:9090/admin + instance: + service-host-type: IP + username: ruoyi + password: 123456 --- # xxl-job 閰嶇疆 -xxl: - job: - # 鎵ц鍣ㄥ紑鍏� - enabled: true - # 璋冨害涓績鍦板潃锛氬璋冨害涓績闆嗙兢閮ㄧ讲瀛樺湪澶氫釜鍦板潃鍒欑敤閫楀彿鍒嗛殧銆� - admin-addresses: http://localhost:9100/xxl-job-admin - # 鎵ц鍣ㄩ�氳TOKEN锛氶潪绌烘椂鍚敤 - access-token: xxl-job - # 鎵ц鍣ㄩ厤缃� - executor: - # 鎵ц鍣ˋppName锛氭墽琛屽櫒蹇冭烦娉ㄥ唽鍒嗙粍渚濇嵁锛涗负绌哄垯鍏抽棴鑷姩娉ㄥ唽 - appname: xxl-job-executor - # 鎵ц鍣ㄧ鍙e彿 鎵ц鍣ㄤ粠9101寮�濮嬪線鍚庡啓 - port: 9101 - # 鎵ц鍣ㄦ敞鍐岋細榛樿IP:PORT - address: - # 鎵ц鍣↖P锛氶粯璁よ嚜鍔ㄨ幏鍙朓P - ip: - # 鎵ц鍣ㄨ繍琛屾棩蹇楁枃浠跺瓨鍌ㄧ鐩樿矾寰� - logpath: ./logs/xxl-job - # 鎵ц鍣ㄦ棩蹇楁枃浠朵繚瀛樺ぉ鏁帮細澶т簬3鐢熸晥 - logretentiondays: 30 +xxl.job: + # 鎵ц鍣ㄥ紑鍏� + enabled: true + # 璋冨害涓績鍦板潃锛氬璋冨害涓績闆嗙兢閮ㄧ讲瀛樺湪澶氫釜鍦板潃鍒欑敤閫楀彿鍒嗛殧銆� + admin-addresses: http://localhost:9100/xxl-job-admin + # 鎵ц鍣ㄩ�氳TOKEN锛氶潪绌烘椂鍚敤 + access-token: xxl-job + executor: + # 鎵ц鍣ˋppName锛氭墽琛屽櫒蹇冭烦娉ㄥ唽鍒嗙粍渚濇嵁锛涗负绌哄垯鍏抽棴鑷姩娉ㄥ唽 + appname: xxl-job-executor + # 鎵ц鍣ㄧ鍙e彿 鎵ц鍣ㄤ粠9101寮�濮嬪線鍚庡啓 + port: 9101 + # 鎵ц鍣ㄦ敞鍐岋細榛樿IP:PORT + address: + # 鎵ц鍣↖P锛氶粯璁よ嚜鍔ㄨ幏鍙朓P + ip: + # 鎵ц鍣ㄨ繍琛屾棩蹇楁枃浠跺瓨鍌ㄧ鐩樿矾寰� + logpath: ./logs/xxl-job + # 鎵ц鍣ㄦ棩蹇楁枃浠朵繚瀛樺ぉ鏁帮細澶т簬3鐢熸晥 + logretentiondays: 30 --- # 鏁版嵁婧愰厤缃� spring: @@ -47,6 +40,8 @@ p6spy: true # 璁剧疆榛樿鐨勬暟鎹簮鎴栬�呮暟鎹簮缁�,榛樿鍊煎嵆涓� master primary: master + # 涓ユ牸妯″紡 鍖归厤涓嶅埌鏁版嵁婧愬垯鎶ラ敊 + strict: true datasource: # 涓诲簱鏁版嵁婧� master: @@ -63,6 +58,23 @@ url: username: password: +# oracle: +# driverClassName: oracle.jdbc.OracleDriver +# url: jdbc:oracle:thin:@//localhost:1521/XE +# username: ROOT +# password: root +# druid: +# validationQuery: SELECT 1 FROM DUAL +# postgres: +# driverClassName: org.postgresql.Driver +# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true +# username: root +# password: root +# sqlserver: +# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver +# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;rewriteBatchedStatements=true +# username: SA +# password: root druid: # 鍒濆杩炴帴鏁� initialSize: 5 @@ -79,7 +91,7 @@ # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�澶х敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 maxEvictableIdleTimeMillis: 900000 # 閰嶇疆妫�娴嬭繛鎺ユ槸鍚︽湁鏁� - validationQuery: SELECT 1 FROM DUAL + validationQuery: SELECT 1 testWhileIdle: true testOnBorrow: false testOnReturn: false @@ -87,29 +99,27 @@ filters: stat --- # druid 閰嶇疆 -spring: - datasource: - druid: - webStatFilter: - enabled: true - statViewServlet: - enabled: true - # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂� - allow: - url-pattern: /druid/* - # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮� - login-username: ruoyi - login-password: 123456 - filter: - stat: - enabled: true - # 鎱QL璁板綍 - log-slow-sql: true - slow-sql-millis: 1000 - merge-sql: true - wall: - config: - multi-statement-allow: true +spring.datasource.druid: + webStatFilter: + enabled: true + statViewServlet: + enabled: true + # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂� + allow: + url-pattern: /druid/* + # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮� + login-username: ruoyi + login-password: 123456 + filter: + stat: + enabled: true + # 鎱QL璁板綍 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: true --- # redis 鍗曟満閰嶇疆(鍗曟満涓庨泦缇ゅ彧鑳藉紑鍚竴涓彟涓�涓渶瑕佹敞閲婃帀) spring: @@ -127,13 +137,39 @@ # 鏄惁寮�鍚痵sl ssl: false + # 閭欢 + mail: + enabled: false + # 閭欢鏈嶅姟鍦板潃 (enabled = true 鏃舵墦寮�璇ラ厤缃�) +# host: smtp.qq.com + # 鐢ㄦ埛鍚� + username: xxx@qq.com + # 鎺堟潈鐮� (璁剧疆 - 璐︽埛 - POP3/SMTP鏈嶅姟) + password: xxx + # QQ閭鍔犲瘑绔彛锛屼笉鍚岄偖绠辩殑绔彛涓嶄竴鏍� + port: 465 + properties: + mail: + smtp: + socketFactory: + class: javax.net.ssl.SSLSocketFactory + ssl: + trust: smtp.qq.com + # 鏄惁闇�瑕佺敤鎴疯璇� + auth: true + starttls: + # 鍚敤TLS鍔犲瘑 + enable: true + required: true + # 浼犺緭鍗忚 starttls.enable = true 鏃朵负 smtps + protocol: smtps + debug: true + redisson: # 绾跨▼姹犳暟閲� threads: 4 # Netty绾跨▼姹犳暟閲� nettyThreads: 8 - # 浼犺緭妯″紡 - transportMode: "NIO" # 鍗曡妭鐐归厤缃� singleServerConfig: # 瀹㈡埛绔悕绉� @@ -146,9 +182,5 @@ idleConnectionTimeout: 10000 # 鍛戒护绛夊緟瓒呮椂锛屽崟浣嶏細姣 timeout: 3000 - # 濡傛灉灏濊瘯鍦ㄦ闄愬埗涔嬪唴鍙戦�佹垚鍔燂紝鍒欏紑濮嬪惎鐢� timeout 璁℃椂銆� - retryAttempts: 3 - # 鍛戒护閲嶈瘯鍙戦�佹椂闂撮棿闅旓紝鍗曚綅锛氭绉� - retryInterval: 1500 # 鍙戝竷鍜岃闃呰繛鎺ユ睜澶у皬 subscriptionConnectionPoolSize: 50 -- Gitblit v1.9.3