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 2019/04/09 15:23:06 UTC

[GitHub] [servicecomb-pack] loveoobaby commented on issue #451: when use eureka, the ${alpha.cluster.address} must be set and can be arbitrary

loveoobaby commented on issue #451: when use eureka, the ${alpha.cluster.address} must be set and can be arbitrary
URL: https://github.com/apache/servicecomb-pack/issues/451#issuecomment-481298810
 
 
   I try to use pack through eureka and modified the booking project. 
   
   In the spring-booking project:
       1. change the pom.xml, add omega-spring-cloud-eureka-starter dependency
       2. change application.yaml config:
   
   ```
   spring:
     application:
       name: booking
   
   server:
     port: 8081
   
   alpha:
     cluster:
   #    address: alpha-server.servicecomb.io:8080
       register:
             type: eureka
   
   eureka:
     client:
       service-url:
         defaultZone: http://127.0.0.1:8761/eureka
     instance:
       prefer-ip-address: true
   ```
   
   I found the application can not be started where the config ${alpha.cluster.address} is deleted, and the value can be arbitrary value. 
   ```
   ***************************
   APPLICATION FAILED TO START
   ***************************
   
   Description:
   
   Parameter 0 of method compensableAnnotationProcessor in org.apache.servicecomb.pack.omega.transaction.spring.TransactionAspectConfig required a bean of type 'org.apache.servicecomb.pack.omega.context.OmegaContext' that could not be found.
   
   The following candidates were found but could not be injected:
   	- Bean method 'omegaContext' in 'OmegaSpringConfig' not loaded because @ConditionalOnProperty (alpha.cluster.address) did not find property 'alpha.cluster.address'
   
   ```
   
   the reason is that the bean OmegaSpringConfig need the key ${alpha.cluster.address} to be triggered, but the value is useless.    And I think in any mode(default, eureka, consul) this bean need to be created, and in eureka, consul model this key is not need to be set, the value can be get from registry center. 
   so,  @ConditionalOnProperty(value = {"alpha.cluster.address"}) can be deleted !
   ```
   @Configuration
   @ConditionalOnProperty(value = {"alpha.cluster.address"})
   class OmegaSpringConfig {
   }
   ```
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services