Skip to content

Commit e21af2e

Browse files
committed
[fix] 异步任务的出错处理日志打印
1 parent 738641f commit e21af2e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

web/src/main/java/demo/web/config/TaskExecutorConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
4949
class SpringAsyncExceptionHandler implements AsyncUncaughtExceptionHandler {
5050
@Override
5151
public void handleUncaughtException(Throwable throwable, Method method, Object... obj) {
52-
log.error("Exception occurs in async method", throwable.getMessage());
52+
log.error("Exception occurs in async method", throwable);
5353
}
5454
}
5555
}

web/src/main/resources/application.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ spring.mail.host=smtp.qq.com
4444
spring.mail.password=你的授权码
4545
spring.mail.username=你的邮箱
4646
spring.mail.properties.mail.transport.protocol=smtp
47-
########### 邮件配置
47+
########### 邮件配置
48+
# 页面未找到时是否抛出异常,404的异常,设置为true可被ControllerAdvice捕获,默认false
49+
spring.mvc.throw-exception-if-no-handler-found=false
50+
# 为资源文件建立映射,及可通过文件名访问静态资源,默认true
51+
# spring.resources.add-mappings=false

0 commit comments

Comments
 (0)