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

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

liubao68 closed pull request #672: [SCB-517]simplify using 
spring-boot-starter-registry
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/672
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/spring-boot-starter/spring-boot-starter-registry/src/main/java/org/apache/servicecomb/springboot/starter/registry/CseAutoConfiguration.java
 
b/spring-boot-starter/spring-boot-starter-registry/src/main/java/org/apache/servicecomb/springboot/starter/registry/ServiceCenterRegistryConfiguration.java
similarity index 73%
rename from 
spring-boot-starter/spring-boot-starter-registry/src/main/java/org/apache/servicecomb/springboot/starter/registry/CseAutoConfiguration.java
rename to 
spring-boot-starter/spring-boot-starter-registry/src/main/java/org/apache/servicecomb/springboot/starter/registry/ServiceCenterRegistryConfiguration.java
index a059b1441..dfff057da 100644
--- 
a/spring-boot-starter/spring-boot-starter-registry/src/main/java/org/apache/servicecomb/springboot/starter/registry/CseAutoConfiguration.java
+++ 
b/spring-boot-starter/spring-boot-starter-registry/src/main/java/org/apache/servicecomb/springboot/starter/registry/ServiceCenterRegistryConfiguration.java
@@ -16,12 +16,17 @@
  */
 package org.apache.servicecomb.springboot.starter.registry;
 
+import org.apache.servicecomb.foundation.common.utils.BeanUtils;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.ImportResource;
+
 /**
 * Initialize and Register the services with service center 
 */
-public class CseAutoConfiguration {
-
-  public CseAutoConfiguration() {
+@Configuration
+@ImportResource(BeanUtils.DEFAULT_BEAN_RESOURCE)
+public class ServiceCenterRegistryConfiguration {
+  public ServiceCenterRegistryConfiguration() {
     RegistryIntializer.initRegistry();
   }
 }
diff --git 
a/spring-boot-starter/spring-boot-starter-registry/src/main/resources/META-INF/spring.factories
 
b/spring-boot-starter/spring-boot-starter-registry/src/main/resources/META-INF/spring.factories
index 8dfa60ef3..d7c1d768f 100644
--- 
a/spring-boot-starter/spring-boot-starter-registry/src/main/resources/META-INF/spring.factories
+++ 
b/spring-boot-starter/spring-boot-starter-registry/src/main/resources/META-INF/spring.factories
@@ -15,4 +15,4 @@
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
 
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=org.apache.servicecomb.springboot.starter.registry.CseAutoConfiguration
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=org.apache.servicecomb.springboot.starter.registry.ServiceCenterRegistryConfiguration
diff --git 
a/spring-boot-starter/spring-boot-starter-registry/src/test/java/org/apache/servicecomb/springboot/starter/registry/TestCseAutoConfiguration.java
 
b/spring-boot-starter/spring-boot-starter-registry/src/test/java/org/apache/servicecomb/springboot/starter/registry/TestServiceCenterRegistryConfiguration.java
similarity index 95%
rename from 
spring-boot-starter/spring-boot-starter-registry/src/test/java/org/apache/servicecomb/springboot/starter/registry/TestCseAutoConfiguration.java
rename to 
spring-boot-starter/spring-boot-starter-registry/src/test/java/org/apache/servicecomb/springboot/starter/registry/TestServiceCenterRegistryConfiguration.java
index dba94e41a..30dab0c23 100644
--- 
a/spring-boot-starter/spring-boot-starter-registry/src/test/java/org/apache/servicecomb/springboot/starter/registry/TestCseAutoConfiguration.java
+++ 
b/spring-boot-starter/spring-boot-starter-registry/src/test/java/org/apache/servicecomb/springboot/starter/registry/TestServiceCenterRegistryConfiguration.java
@@ -25,7 +25,7 @@
 
 import mockit.Expectations;
 
-public class TestCseAutoConfiguration {
+public class TestServiceCenterRegistryConfiguration {
 
   @Test
   public void testInitRegistry() {
@@ -40,7 +40,7 @@ public void testInitRegistry() {
       }
     };
     System.setProperty("cse.rest.address", "127.0.0.1:8081");
-    new CseAutoConfiguration();
+    new ServiceCenterRegistryConfiguration();
     Assert.assertEquals("rest://127.0.0.1:8081", 
RegistryUtils.getPublishAddress("rest", "127.0.0.1:8081"));
   }
 


 

----------------------------------------------------------------
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:
us...@infra.apache.org


> service center starter for spring boot/cloud improvement
> --------------------------------------------------------
>
>                 Key: SCB-517
>                 URL: https://issues.apache.org/jira/browse/SCB-517
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>            Reporter: liubao
>            Assignee: liubao
>            Priority: Major
>
> Now, when enabled spring-boot-starter-discovery, we should add 
> @EnableAutoConfiguration
> @ImportResource(locations = "classpath*:META-INF/spring/*.bean.xml")
> to user class. But we can simplify it to write no code. On the other hand, if 
> user use this two code, it will work fine. 



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

Reply via email to