dependency 추가<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency><dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency><dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>Config Server
spring:
rabbitmq:
host: 127.0.0.1
port: 5672
username: guest
password: guest
management:
endpoints:
web:
exposure:
include: health, busrefresh
User service
spring:
rabbitmq:
host: 127.0.0.1
port: 5672
username: guest
password: guest
management:
endpoints:
web:
exposure:
include: refresh, health, beans, busrefresh
API Gateway Service
spring:
rabbitmq:
host: 127.0.0.1
port: 5672
username: guest
password: guest
management:
endpoints:
web:
exposure:
include: refresh, health, beans, httpexchanges, busrefresh
💡 추가 설명
- User Service, GW Service, Config Server RabbitMQ의 클라이언트(Client) 역할로 등록
➡ RabbitMQ의 변경사항이 생길 경우,AMQP프로토콜로 전달 받기 위함- 포트 번호
1.AMQP: 5672
2.RabbitMQ: 15672include설정 정보
➡ Spring Cloud 2020.0.0. 부터 End-point 이름 변경됨
1.bus-env➡busenv
2.bus-refresh➡busrefresth
✅ 실행 순서: RabbitMQ 서버 기동 → Config Server → Eureka Server → Gateway Server → User Service

bootstrap.xml 수정spring:
cloud:
config:
uri: http://127.0.0.1:8888
name: config-service
# profiles:
# active: dev💡
spring.profiles.active주석 처리 한 이유
➡ config Server 설정 정보를 사용하기 위함
회원가입

로그인

health_check

Config 설정 정보 변경

변경된 설정 정보 확인

user-service 에서 busrefresh 실행

로그 확인


✅ 로그 설명
user-service의 로그(위)와GW service의 로그(아래)user-service에서 설정 정보가 변경된 것을 적용하였고(busrefresh), RabbitMQ에 연결되어 있는 모든 클라이언트 서비스에 해당 메시지가 Push 기능으로 전달되어 적용됨

Config 설정 정보 변경

변경 사항 확인
