15
15
16
16
#### 代码片段:pom.xml
17
17
18
- ```
18
+ ``` xml
19
19
<properties >
20
20
<project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
21
21
<java .version>1.8</java .version>
99
99
100
100
#### 文件内容:app.properties
101
101
102
- ```
102
+ ``` properties
103
103
app.name =tio-boot-example-push-exception-to-wecome-demo
104
104
notification.webhook.url =https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key =xxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxx
105
105
```
@@ -110,7 +110,7 @@ notification.webhook.url=https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xx
110
110
111
111
#### 代码片段:ExceptionPushToWecomeApp.java
112
112
113
- ```
113
+ ``` java
114
114
package com.litongjava.tio.web.hello ;
115
115
116
116
import com.litongjava.jfinal.aop.annotation.AComponentScan ;
@@ -132,7 +132,7 @@ public class ExceptionPushToWecomeApp {
132
132
133
133
创建自定义的异常处理器 ` GlobalExceptionHadler ` ,在处理器中捕获异常并构建告警信息,最后通过企业微信 Webhook 接口发送到微信群。
134
134
135
- ```
135
+ ``` java
136
136
import java.io.PrintWriter ;
137
137
import java.io.StringWriter ;
138
138
import java.util.Date ;
@@ -190,7 +190,7 @@ public class GlobalExceptionHadler implements TioBootExceptionHandler {
190
190
191
191
#### 代码片段:TioBootServerConfiguration.java
192
192
193
- ```
193
+ ``` java
194
194
import com.litongjava.jfinal.aop.annotation.AConfiguration ;
195
195
import com.litongjava.jfinal.aop.annotation.AInitialization ;
196
196
import com.litongjava.tio.boot.server.TioBootServer ;
@@ -210,7 +210,7 @@ public class TioBootServerConfiguration {
210
210
211
211
开发一个简单的控制器,用于模拟触发异常的场景。
212
212
213
- ```
213
+ ``` java
214
214
package com.litongjava.tio.web.hello.controller ;
215
215
216
216
import com.litongjava.tio.http.server.annotation.RequestPath ;
@@ -233,7 +233,7 @@ public class ExceptionController {
233
233
234
234
#### 企业微信群收到的告警信息示例:
235
235
236
- ```
236
+ ``` log
237
237
Alarm Time : 2024-02-04 10:43:08
238
238
App Group Name : tio-boot
239
239
App Name : tio-boot-example-push-exception-to-wecome-demo
0 commit comments