Spring Cloud로 개발하는 MSA/Users Microservice

Users Microservice - 프로젝트 생성

webmaster 2022. 1. 31. 12:26
728x90

프로젝트 생성
유레카 클라이언트임을 명시

application.yml 

Eureka Client 등록

  • UserMicroService를 생성하고, ErekaClient로 등록한다.

YML 환경변수 읽어오기

yml의 greeting.message 환경변수 읽어오기

  • 방법 1

환경 변수 빈의 불러와 Property를 읽는다.

- env.getProperty("greeting.message")

  • 방법 2

@Value를 사용하여 yml 값을 읽는다.

- @Value와 SpEL문법을 사용하여 YML값을 읽어올 수 있다.

728x90