天天看点

SpringCloud-Eureka【入门案例】

SpringCloud-Eureka【入门案例】
SpringCloud-Eureka【入门案例】
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
        <version>1.4.5.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-eureka-server</artifactId>
        <version>1.3.2.RELEASE</version>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Dalston.SR5</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>      
SpringCloud-Eureka【入门案例】
@EnableEurekaServer
@SpringBootApplication
public class SpringcloudEurekaDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringcloudEurekaDemoApplication.class, args);
    }
}      
SpringCloud-Eureka【入门案例】
spring.application.name=eureka-server
server.port=8761

# 是否将自己注册到Eureka中,默认true
eureka.client.register-with-eureka=false
# 是否从Eureka服务中获取注册信息默认是true
eureka.client.fetch-registry=false      
SpringCloud-Eureka【入门案例】

继续阅读