Explorar o código

add property to control whether to enable embedded eureka server or not

小强 %!s(int64=5) %!d(string=hai) anos
pai
achega
161fa8502a

+ 4 - 0
apollo-configservice/src/main/config/application-github.properties

@@ -2,3 +2,7 @@
 spring.datasource.url = ${spring_datasource_url}
 spring.datasource.username = ${spring_datasource_username}
 spring.datasource.password = ${spring_datasource_password}
+
+
+#apollo.eureka.server.enabled=true
+#apollo.eureka.client.enabled=true

+ 16 - 0
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServerEurekaClientConfigure.java

@@ -0,0 +1,16 @@
+package com.ctrip.framework.apollo.configservice;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Start Eureka Client annotations according to configuration
+ *
+ * @author Zhiqiang Lin(linzhiqiang0514@163.com)
+ */
+@Configuration
+@EnableEurekaClient
+@ConditionalOnProperty(name = "apollo.eureka.client.enabled", havingValue = "true", matchIfMissing = true)
+public class ConfigServerEurekaClientConfigure {
+}

+ 16 - 0
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServerEurekaServerConfigure.java

@@ -0,0 +1,16 @@
+package com.ctrip.framework.apollo.configservice;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Start Eureka Server annotations according to configuration
+ *
+ * @author Zhiqiang Lin(linzhiqiang0514@163.com)
+ */
+@Configuration
+@EnableEurekaServer
+@ConditionalOnProperty(name = "apollo.eureka.server.enabled", havingValue = "true", matchIfMissing = true)
+public class ConfigServerEurekaServerConfigure {
+}

+ 0 - 1
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServiceApplication.java

@@ -19,7 +19,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
  * @author Jason Song(song_s@ctrip.com)
  */
 
-@EnableEurekaServer
 @EnableAspectJAutoProxy
 @EnableAutoConfiguration // (exclude = EurekaClientConfigBean.class)
 @Configuration