创建一个 ==spring boot== 工程 ,在pom.xml中引入 ==eureka-server== 依赖
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
在==springboot应用==中添加==@EnableEurekaServer==注解,启动一个服务注册中心
@EnableEurekaServer
@SpringBootApplication
public class ServerApplication {
public static void main(String[] args) {
SpringApplication.run(ServerApplication.class, args);
}
}
修改application.yml配置
spring:
application:
name: server
server:
port: 10000
eureka:
instance:
hostname: localhost
client:
register-with-eureka: false
fetch-registry: false