From fb95acc8cea902688fa51dd63d7b02f377f03141 Mon Sep 17 00:00:00 2001 From: click33 <2393584716@qq.com> Date: Wed, 19 Mar 2025 04:34:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=20SaTokenPluginForJackson=20?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E8=BE=83=E5=BC=B1=E7=9A=84=E4=BC=98=E5=85=88?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sa-token-demo/sa-token-demo-test/pom.xml | 2 +- .../cn/dev33/satoken/plugin/SaTokenPluginForJackson.java | 6 +++++- sa-token-starter/sa-token-spring-boot-autoconfig/pom.xml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sa-token-demo/sa-token-demo-test/pom.xml b/sa-token-demo/sa-token-demo-test/pom.xml index 0ac983f4..b0a5dba5 100644 --- a/sa-token-demo/sa-token-demo-test/pom.xml +++ b/sa-token-demo/sa-token-demo-test/pom.xml @@ -33,7 +33,7 @@ org.springframework.boot spring-boot-starter-aop - + cn.dev33 diff --git a/sa-token-plugin/sa-token-jackson/src/main/java/cn/dev33/satoken/plugin/SaTokenPluginForJackson.java b/sa-token-plugin/sa-token-jackson/src/main/java/cn/dev33/satoken/plugin/SaTokenPluginForJackson.java index 870d4e8d..2c312949 100644 --- a/sa-token-plugin/sa-token-jackson/src/main/java/cn/dev33/satoken/plugin/SaTokenPluginForJackson.java +++ b/sa-token-plugin/sa-token-jackson/src/main/java/cn/dev33/satoken/plugin/SaTokenPluginForJackson.java @@ -16,6 +16,7 @@ package cn.dev33.satoken.plugin; import cn.dev33.satoken.SaManager; +import cn.dev33.satoken.json.SaJsonTemplateDefaultImpl; import cn.dev33.satoken.json.SaJsonTemplateForJackson; /** @@ -28,7 +29,10 @@ public class SaTokenPluginForJackson implements SaTokenPlugin { @Override public void install() { - SaManager.setSaJsonTemplate(new SaJsonTemplateForJackson()); + // 只有在未提供自定义的 json 解析器时才会生效,给于其较弱的优先级 + if(SaManager.getSaJsonTemplate().getClass() == SaJsonTemplateDefaultImpl.class){ + SaManager.setSaJsonTemplate(new SaJsonTemplateForJackson()); + } } } \ No newline at end of file diff --git a/sa-token-starter/sa-token-spring-boot-autoconfig/pom.xml b/sa-token-starter/sa-token-spring-boot-autoconfig/pom.xml index 95227301..67ab67be 100644 --- a/sa-token-starter/sa-token-spring-boot-autoconfig/pom.xml +++ b/sa-token-starter/sa-token-spring-boot-autoconfig/pom.xml @@ -43,7 +43,7 @@ true - + cn.dev33 sa-token-jackson