Skip to content

Commit

Permalink
Change order module to Eureka client
Browse files Browse the repository at this point in the history
  • Loading branch information
lai3d committed Sep 8, 2021
1 parent 3970da0 commit 67f38ef
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
7 changes: 7 additions & 0 deletions cloud-consumer-order80/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
<artifactId>cloud-consumer-order80</artifactId>

<dependencies>
<!-- 服务注册中心的客户端端 eureka-client -->
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-eureka-server -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

<dependency>
<groupId>com.atguigu.springcloud</groupId>
<artifactId>cloud-api-commons</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;

@SpringBootApplication
@EnableEurekaClient
public class OrderMain80 {
public static void main(String[] args) {
SpringApplication.run(OrderMain80.class, args);
Expand Down
19 changes: 18 additions & 1 deletion cloud-consumer-order80/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
server:
port: 80
port: 80

spring:
application:
name: cloud-order-service

eureka:
client:
#是否向注册中心注册自己
register-with-eureka: true
#是否从注册中心抓取已有的注册信息 默认true,集群必须设置为true
fetchRegistry: true
service-url:
#设置与eureka server交互的地址查询服务和注册服务都需要依赖这个地址
#单机版
defaultZone: http:https://localhost:7001/eureka
#集群版
#defaultZone: http:https://eureka7001.com:7001/eureka,http:https://eureka7002.com:7002/eureka

0 comments on commit 67f38ef

Please sign in to comment.