You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/06/21 02:10:31 UTC

[GitHub] wujimin commented on a change in pull request #772: [SCB-194] Spring default scan main class package

wujimin commented on a change in pull request #772: [SCB-194] Spring default scan main class package
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/772#discussion_r196992995
 
 

 ##########
 File path: foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/BeanUtils.java
 ##########
 @@ -33,10 +42,41 @@ public static void init() {
     init(DEFAULT_BEAN_RESOURCE);
   }
 
+
   public static void init(String... configLocations) {
+    prepareServiceCombScanPackage();
+
     context = new ClassPathXmlApplicationContext(configLocations);
   }
 
+  public static void prepareServiceCombScanPackage() {
+    Set<String> scanPackags = new LinkedHashSet<>();
+    // add exists settings
+    String exists = System.getProperty(SCB_SCAN_PACKAGE);
+    if (exists != null) {
+      for (String exist : exists.trim().split(",")) {
+        if (!exist.isEmpty()) {
+          scanPackags.add(exist.trim());
+        }
+      }
+    }
+
+    // ensure servicecomb package exist
+    scanPackags.add(SCB_PACKAGE);
+
+    // add main class package
+    Class<?> mainClass = JvmUtils.findMainClass();
 
 Review comment:
   yes
   but maybe invoke System.setProperty("scb-scan-package", "a.b.c") before BeanUtils.init is enough?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services