[ 
https://issues.apache.org/jira/browse/SCB-194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16518803#comment-16518803
 ] 

ASF GitHub Bot commented on SCB-194:
------------------------------------

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:
[email protected]


> Improve component-scan setting
> ------------------------------
>
>                 Key: SCB-194
>                 URL: https://issues.apache.org/jira/browse/SCB-194
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Java-Chassis
>            Reporter: yangyongzheng
>            Assignee: wujimin
>            Priority: Major
>              Labels: roadmap
>
> Current in Producer side,we need add META-INF/spring/xxx.bean.xml file 
> contains:
>     <context:component-scan base-package="xxx.xxx.xxx" />
> in order to define base package path,we may need find a way to add main class 
> package to component-scan path automatically



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to