From 360fe689b1df765ca6754d32921c1ee18f9e9c00 Mon Sep 17 00:00:00 2001 From: xubinbin <1323875150@qq.com> Date: 星期二, 12 十二月 2023 16:41:15 +0800 Subject: [PATCH] 增加日志记录时的完全限定类名,用于定位日志位置。 ps:2023-12-12 16:30:58.779 [Thread-10] INFO --- gov.nist.javax.sip.stack.UDPMessageChannel : 81 Done processing MESSAGE sip:44010200492000000003@4401020049 SIP/2.0 日志中的“gov.nist.javax.sip.stack.UDPMessageChannel”内容 --- src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java b/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java index e1088e5..c8b84fe 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java @@ -1,9 +1,12 @@ package com.genersoft.iot.vmp.conf; -import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.support.spring.http.converter.FastJsonHttpMessageConverter; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import org.jetbrains.annotations.NotNull; +import org.springframework.boot.autoconfigure.http.HttpMessageConverters; +import org.springframework.context.annotation.Bean; import org.springframework.core.MethodParameter; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; @@ -24,6 +27,7 @@ public boolean supports(@NotNull MethodParameter returnType, @NotNull Class<? extends HttpMessageConverter<?>> converterType) { return true; } + @Override public Object beforeBodyWrite(Object body, @NotNull MethodParameter returnType, @NotNull MediaType selectedContentType, @NotNull Class<? extends HttpMessageConverter<?>> selectedConverterType, @NotNull ServerHttpRequest request, @NotNull ServerHttpResponse response) { @@ -50,4 +54,13 @@ return WVPResult.success(body); } + + /** + * 闃叉杩斿洖string鏃跺嚭閿� + * @return + */ + @Bean + public HttpMessageConverters fast() { + return new HttpMessageConverters(new FastJsonHttpMessageConverter()); + } } -- Gitblit v1.8.0