springCloud依赖
pom文件中加入依赖
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Dalston.SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
启动类申明eureka服务端
@SpringBootApplication
@EnableEurekaServer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
配置
spring.application.name=eureka-server
server.port=8761
#是否将自己注册到eureka-server 默认为true
eureka.client.registerWithEureka=false
#是否从eureka-server获取注册信息,默认为true
eureka.client.fetchRegistry=false