You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2022/06/08 06:19:40 UTC

[dubbo] branch 3.0 updated: [3.0] Disable migration file default (#10127)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 0d98caa0be [3.0] Disable migration file default (#10127)
0d98caa0be is described below

commit 0d98caa0bede335ec4208ab719dfd86fe9e54879
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Wed Jun 8 14:19:14 2022 +0800

    [3.0] Disable migration file default (#10127)
---
 .../org/apache/dubbo/common/config/Environment.java    | 18 +++++++++++++-----
 .../apache/dubbo/common/constants/CommonConstants.java |  2 ++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
index e4aed19745..36c6b2e1a9 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Environment.java
@@ -89,15 +89,23 @@ public class Environment extends LifecycleAdapter implements ApplicationExt {
         }
     }
 
+    /**
+     * @deprecated MigrationRule will be removed in 3.1
+     */
+    @Deprecated
     private void loadMigrationRule() {
-        String path = System.getProperty(CommonConstants.DUBBO_MIGRATION_KEY);
-        if (StringUtils.isEmpty(path)) {
-            path = System.getenv(CommonConstants.DUBBO_MIGRATION_KEY);
+        if (Boolean.parseBoolean(System.getProperty(CommonConstants.DUBBO_MIGRATION_FILE_ENABLE, "false"))) {
+            String path = System.getProperty(CommonConstants.DUBBO_MIGRATION_KEY);
             if (StringUtils.isEmpty(path)) {
-                path = CommonConstants.DEFAULT_DUBBO_MIGRATION_FILE;
+                path = System.getenv(CommonConstants.DUBBO_MIGRATION_KEY);
+                if (StringUtils.isEmpty(path)) {
+                    path = CommonConstants.DEFAULT_DUBBO_MIGRATION_FILE;
+                }
             }
+            this.localMigrationRule = ConfigUtils.loadMigrationRule(scopeModel.getClassLoaders(), path);
+        } else {
+            this.localMigrationRule = null;
         }
-        this.localMigrationRule = ConfigUtils.loadMigrationRule(scopeModel.getClassLoaders(), path);
     }
 
     /**
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
index 861892df7f..bc97fefddb 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
@@ -61,6 +61,8 @@ public interface CommonConstants {
 
     String DUBBO_MIGRATION_KEY = "dubbo.migration.file";
 
+    String DUBBO_MIGRATION_FILE_ENABLE = "dubbo.migration-file.enable";
+
     String DEFAULT_DUBBO_MIGRATION_FILE = "dubbo-migration.yaml";
 
     String ANY_VALUE = "*";