SpringBoot profile 적용하는법

leeminsu·2021년 12월 31일
post-thumbnail
  1. 먼저 스프링 부트 application.properties에 아래와 같이 profiles를 정의한다.

    > spring.profiles.active=dev

    2.tomcat/bin 디렉토리에서 setenv 파일 작성
    2.1 리눅스
    setenv.sh 파일 생성 후 아래와 같이 작성
    JAVA_OPTS="$JAVA_OPTS -Dspring.profiles.active={profile_name}"

    2.2 Window
    setenv.bat 파일 생성 후 아래와 같이 작성
    JAVA_OPTS=%JAVA_OPTS% -Dspring.profiles.active={profile_name}

  2. application.properties 구조

profile
프로게이머 아니고 프로그래머

0개의 댓글