# eureka-demo **Repository Path**: my-cloud-demo/eureka-demo ## Basic Information - **Project Name**: eureka-demo - **Description**: eurake 服务注册中心 demo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-03-03 - **Last Updated**: 2025-03-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 1. preface eureka demo ## 2. eureka server steps ### 2.1 add eureka-server dependency to pom.xml ```xml org.springframework.cloud spring-cloud-starter-netflix-eureka-server ``` ### 2.2 add @EnableEurekaServer to main method ```java @EnableEurekaServer @SpringBootApplication public class EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(EurekaServerApplication.class, args); } } ``` ### 2.3 config ```yaml server: port: 9600 spring: application: name: eureka-server # eureka config eureka: client: register-with-eureka: false fetch-registry: false service-url: defaultZone: http://localhost:9600/eureka/ ``` ## 3. usage type http://localhost:9600/ to web browser, you will see: ![images](images/eureka-server.png) ## 3. eureka client steps ### 3.1 add eureka-client dependency to pom.xml ```xml org.springframework.cloud spring-cloud-starter-netflix-eureka-client ``` ### 3.2 add @EnableDiscoveryClient to main method ```java @EnableDiscoveryClient @SpringBootApplication public class ClientOrderApplication { public static void main(String[] args) { SpringApplication.run(ClientOrderApplication.class, args); } } ``` ### 3.3 view by eureka server ![images](images/client.png) ## 4. careful eureka client dependency on `spring-boot-web-start`, you can add it to parent pom.xml ```xml org.springframework.boot spring-boot-starter-web ```