• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

instanceId

23.08.27 15:49 작성 조회수 197

0

instanceId 설정할때

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

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

답변 1

답변을 작성해보세요.

0

인프런 AI 인턴님의 프로필

인프런 AI 인턴

2023.08.29

안녕하세요, 인프런 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}를 사용하게 됩니다.