1. properties 우선 순위
1. war(jar)파일과 같은 위치에 있는 application.properties
2. Testcase 폴더내에 위치한 application.properties (Test 시)
3. classpath 내에 config 폴더에 위치한 application.properties
4. classpath 내에 config 폴더에 위치한 application-{profile명}.properties
5. classpath 내에 위치한 application.properties
6. classpath 내에 위치한 application-{profile명}.properties
2. Profile
개발 설정, 배포 설정이 다른 경우
환경별로 properties파일을 생성하고 실행 시 선택하거나, 조정 할 수 있음
application-{profile명}.properties
1. profile 선택
a. application.properties 내에서
spring.profiles.active=프로파일명
spring.config.import=application-{profile명}.properties
b. build 시 선택
c. war 실행시 선택
java -jar app.war --spring.profiles.active=프로파일명
java -jar app.war -Dspring.profiles.active=프로파일명
3. Build
1. default
./mvnw clean install
2. 특정한 properties
./mvnw clean install -Dspring.profiles.active=프로파일명
3. Build시 Test Skip
1) ./mvnw clean install -Dmaven.test.skip=true
2) ./mvnw clean install -Dsk -ipTests
3) pom.xml에 plugin 추가
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
4. War실행시 특정한 properties 실행
java -jar ***.war --spring.profiles.active=프로파일명
java -jar ***.war -Dspring.profiles.active=프로파일명