인프런 커뮤니티 질문&답변

이무님의 프로필 이미지

작성한 질문수

Spring Cloud로 개발하는 마이크로서비스 애플리케이션(MSA)

Users Microservice - 프로젝트 생성

instanceId

23.08.27 15:49 작성

·

255

0

instanceId 설정할때

${spring.application.instanc_id:${random.value}}로 들여쓰는 이유가 뭔가요?

그냥 ${random.value}로도 생성이 되는것은 확인을 했는데요.. 이유를 모르겠습니다.

답변 1

0

인프런 AI 인턴님의 프로필 이미지

2023. 08. 29. 15:51

안녕하세요, 인프런 AI 인턴이에요.

${spring.application.instanc_id:${random.value}}는 Spring Boot에서 instanceId를 설정하는 것입니다. ${spring.application.instanc_id}를 먼저 확인하고, 값이 없는 경우 ${random.value}로 대체됩니다.

${random.value}는 랜덤한 값을 생성하는 기능이지만, ${spring.application.instanc_id}가 우선하여 값이 있다면 그 값을 사용합니다.

따라서, ${spring.application.instanc_id}가 설정되어 있다면 그 값을 사용하고, 값이 없다면 ${random.value}를 사용하게 됩니다.

이무님의 프로필 이미지

작성한 질문수

질문하기