Spring Boot – Spring Profile

By | 2025년 3월 9일
Table of Contents

Spring Boot – Spring Profile

파일명

아래와 같은 형식을 가진다.

application-{profile}.properties or application-{profile}.yml

일반적으로 application-prd.yml, application-dev.yml 의 파일명이 쓰이는 것이 일반적이다.

인텔리제이

메뉴 > Run > Edit Configurations

여기서 프로젝트명을 선택하고 Active profiles 을 설정해 준다.

jar 실행시

java -jar your-app.jar --spring.profiles.active=prd

디폴트 프로파일

위와 같이 application.yml 을 추가로 생성 후,
내용을 아래와 같이 입력한다.

spring:
  profiles:
    active: prd

다른 프로파일 설정이 있는 경우는 해당 설정으로 실행되고,
별도 설정이 없는 경우 prd 가 디폴트로 설정된다.

답글 남기기