Convert Eureka client autoconfig to @EnableEurekaClient
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.platform.netflix.eureka;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Import(EurekaClientConfiguration.class)
|
||||
public @interface EnableEurekaClient {
|
||||
|
||||
}
|
||||
@@ -43,10 +43,10 @@ import com.netflix.discovery.EurekaClientConfig;
|
||||
EurekaInstanceConfigBean.class })
|
||||
@ConditionalOnClass(EurekaClientConfig.class)
|
||||
@ConditionalOnExpression("${eureka.client.enabled:true}")
|
||||
public class EurekaClientAutoConfiguration implements
|
||||
public class EurekaClientConfiguration implements
|
||||
ApplicationListener<ContextRefreshedEvent>, SmartLifecycle, Ordered {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EurekaClientAutoConfiguration.class);
|
||||
private static final Logger logger = LoggerFactory.getLogger(EurekaClientConfiguration.class);
|
||||
|
||||
private boolean running;
|
||||
|
||||
@@ -32,7 +32,6 @@ import com.netflix.blitz4j.LoggingConfiguration;
|
||||
import com.netflix.eureka.EurekaBootStrap;
|
||||
import com.netflix.eureka.EurekaServerConfig;
|
||||
import com.netflix.eureka.EurekaServerConfigurationManager;
|
||||
import com.netflix.eureka.PeerAwareInstanceRegistry;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -42,6 +41,7 @@ import com.netflix.eureka.PeerAwareInstanceRegistry;
|
||||
@EnableConfigurationProperties(EurekaServerConfigBean.class)
|
||||
@ConditionalOnClass(EurekaServerConfig.class)
|
||||
@ConditionalOnExpression("${eureka.server.enabled:true}")
|
||||
@EnableEurekaClient
|
||||
public class EurekaServerAutoConfiguration implements ServletContextAware,
|
||||
SmartLifecycle, Ordered {
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
org.springframework.platform.netflix.archaius.ArchaiusAutoConfiguration,\
|
||||
org.springframework.platform.netflix.eureka.EurekaClientAutoConfiguration,\
|
||||
org.springframework.platform.netflix.eureka.EurekaServerAutoConfiguration,\
|
||||
org.springframework.platform.netflix.feign.FeignAutoConfiguration
|
||||
@@ -18,6 +18,13 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!--skip deploy (this is just a test module) -->
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!--skip deploy (this is just a test module) -->
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -16,19 +16,17 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!--skip deploy (this is just a test module) -->
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user