Copilot commented on code in PR #8067:
URL: https://github.com/apache/incubator-seata/pull/8067#discussion_r3129799781


##########
common/src/main/java/org/apache/seata/common/DefaultValues.java:
##########
@@ -341,11 +341,16 @@ public interface DefaultValues {
      */
     String DEFAULT_SAGA_JSON_PARSER = "fastjson";
 
+    /**
+     * The default global JSON serializer.
+     */
+    String BUSINESS_ACTION_CONTEXT_JSON_PARSER = "jackson";
+
     /**
      * The constant DEFAULT_TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER.
      */
-    // default tcc business action context json parser
-    String DEFAULT_TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER = "fastjson";
+    @Deprecated
+    String DEFAULT_TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER = 
BUSINESS_ACTION_CONTEXT_JSON_PARSER;

Review Comment:
   `DEFAULT_TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER` used to default to 
"fastjson" but is now deprecated and aliased to 
`BUSINESS_ACTION_CONTEXT_JSON_PARSER` ("jackson"). This is a behavioral change 
for users who relied on the previous default without configuring a serializer; 
if the PR intent is only config-key migration, consider keeping the old default 
or ensure this default change is explicitly called out in upgrade notes.



##########
json-common/json-common-core/src/main/java/org/apache/seata/common/json/JsonUtil.java:
##########
@@ -29,14 +33,32 @@
  */
 public final class JsonUtil {
 
-    private static final String CONFIG_JSON_PARSER_NAME = 
ConfigurationFactory.getInstance()
-            .getConfig(
-                    
ConfigurationKeys.TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER_NAME,
-                    
DefaultValues.DEFAULT_TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER);
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(JsonUtil.class);
+
+    private static final String CONFIG_JSON_PARSER_NAME = 
resolveJsonSerializerName(ConfigurationFactory.getInstance());
 
     private static final JsonSerializer DEFAULT_SERIALIZER =
             JsonSerializerFactory.getSerializer(CONFIG_JSON_PARSER_NAME);
 
+    static String resolveJsonSerializerName(Configuration configuration) {
+        String serializerType = 
configuration.getConfig(ConfigurationKeys.JSON_SERIALIZER_TYPE);
+        if (StringUtils.isNotBlank(serializerType)) {
+            return serializerType;
+        }
+
+        String deprecatedSerializerType =
+                
configuration.getConfig(ConfigurationKeys.TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER_NAME);
+        if (StringUtils.isNotBlank(deprecatedSerializerType)) {
+            LOGGER.warn(
+                    "The config '{}' is deprecated since 2.7.0 and will be 
removed in a future version. Please use '{}' instead.",
+                    
ConfigurationKeys.TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER_NAME,
+                    ConfigurationKeys.JSON_SERIALIZER_TYPE);
+            return deprecatedSerializerType;
+        }
+
+        return DefaultValues.BUSINESS_ACTION_CONTEXT_JSON_PARSER;
+    }

Review Comment:
   `resolveJsonSerializerName` now falls back to 
`DefaultValues.BUSINESS_ACTION_CONTEXT_JSON_PARSER` (currently "jackson") when 
neither the new nor deprecated config is set. This changes the effective 
default JSON serializer compared to the previous behavior (which defaulted via 
`DEFAULT_TCC_BUSINESS_ACTION_CONTEXT_JSON_PARSER`), so please confirm this 
default change is intentional and aligned with the PR scope; otherwise keep the 
previous default for backward compatibility (or document it as a breaking 
change).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to