From 7bdc1b06d3757acca541d47091a782691cd807d3 Mon Sep 17 00:00:00 2001 From: zhangdaiscott Date: Fri, 25 Feb 2022 11:09:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3okhttp=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E4=BA=86kotlin,=E5=BA=94=E7=94=A8=E5=90=AF=E5=8A=A8=E6=9C=89?= =?UTF-8?q?=E8=AD=A6=E5=91=8A=E6=97=A5=E5=BF=97=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=E8=B6=85=E9=99=90=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=B8=8D=E5=87=86=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml | 5 +++++ .../jeecg/common/exception/JeecgBootExceptionHandler.java | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml index 25126f7a..732fd3aa 100644 --- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/pom.xml @@ -239,6 +239,11 @@ com.squareup.okhttp3 okhttp + + + com.fasterxml.jackson.module + jackson-module-kotlin + \ No newline at end of file diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java index 8d931e21..2c17c81a 100644 --- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java +++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootExceptionHandler.java @@ -4,6 +4,7 @@ import io.lettuce.core.RedisConnectionException; import org.apache.shiro.authz.AuthorizationException; import org.apache.shiro.authz.UnauthorizedException; import org.jeecg.common.api.vo.Result; +import org.springframework.beans.factory.annotation.Value; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DuplicateKeyException; import org.springframework.data.redis.connection.PoolException; @@ -26,7 +27,8 @@ import lombok.extern.slf4j.Slf4j; @RestControllerAdvice @Slf4j public class JeecgBootExceptionHandler { - + @Value("${spring.servlet.multipart.max-file-size}") + private String maxFileSize; /** * 处理自定义异常 */ @@ -100,7 +102,7 @@ public class JeecgBootExceptionHandler { @ExceptionHandler(MaxUploadSizeExceededException.class) public Result handleMaxUploadSizeExceededException(MaxUploadSizeExceededException e) { log.error(e.getMessage(), e); - return Result.error("文件大小超出10MB限制, 请压缩或降低文件质量! "); + return Result.error(String.format("文件大小超出%s限制, 请压缩或降低文件质量! ", maxFileSize)); } @ExceptionHandler(DataIntegrityViolationException.class)