From 1e1ad28fc151882a875ecc99e092f55099a6aadc Mon Sep 17 00:00:00 2001 From: liangwen <2357318727@qq.com> Date: Thu, 11 Sep 2025 14:27:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96OnlyOffice=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8DObjectMapper=20Bean=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=8E=9F=E9=A1=B9=E7=9B=AEPUT=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8A=A5JSON=E5=8F=8D=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/onlyoffice/OnlyofficeConfiguration.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hb-file/src/main/java/com/ruoyi/file/config/onlyoffice/OnlyofficeConfiguration.java b/hb-file/src/main/java/com/ruoyi/file/config/onlyoffice/OnlyofficeConfiguration.java index 2e55a55..a49cdd7 100644 --- a/hb-file/src/main/java/com/ruoyi/file/config/onlyoffice/OnlyofficeConfiguration.java +++ b/hb-file/src/main/java/com/ruoyi/file/config/onlyoffice/OnlyofficeConfiguration.java @@ -18,6 +18,7 @@ package com.ruoyi.file.config.onlyoffice; +import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.file.office.documentserver.storage.FileStoragePathBuilder; import com.ruoyi.file.office.documentserver.util.SSLUtils; @@ -28,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import javax.annotation.PostConstruct; @@ -78,8 +80,15 @@ public class OnlyofficeConfiguration { } } +// @Bean +// public ObjectMapper objectMapper(){ // create the object mapper +// return new ObjectMapper(); +// } + @Bean - public ObjectMapper objectMapper(){ // create the object mapper - return new ObjectMapper(); + public ObjectMapper objectMapper(Jackson2ObjectMapperBuilder builder) { + ObjectMapper mapper = builder.createXmlMapper(false).build(); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + return mapper; } }