로딩
요청 처리 중입니다...

개발환경에 맞는 Spring Profile 설정 tomcat (local, dev, prod)

 개발환경에 맞는 Spring Profile 설정  tomcat (local, dev, prod)

개발환경에 맞는 Spring Profile 설정하기 개발을 하다 보면 데이터베이스 설정, 파일 위치설정 등 환경에 따라 설정이 다른 경우 config파일을 여러 개 사용할 때가 있다. local_set.config : 로컬환경 dev_set.config : 테스트서버환경 prod_set.config : 배포서버환경 각 파일을 생성하고 환경에 따라 다르게 읽어 들여서 각각 설정을 해줄 것이다. 이클립스에서 tomcat인 경우 설정 Servers에 뜨는 tomcat을 더블클릭하면 위와 같은 화면이 뜬다.

Open launch configuration 을 클릭한다. -Dspring.profiles.active=local Arguments 탭을 클릭한 후 VM arguments 부분에 환경에 맞게 추가해준다.

로컬환경설정인 경우 -Dspring.profiles.active=local 테스트서버환경인 경우 -Dspring.profiles.active=dev 배포서버환경인 경우 -Dspring...