創建一個 ==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