2.3.7.RELEASE ํํ๋ก ์ ๊ณต๋๋ ๋ฒ์ ์ ํํ๊ฐ 2.4.0์ผ๋ก ์ฌํํ๊ฒ ๋ณ๊ฒฝ๋์์ต๋๋ค.
Spring Boot 2.4.0 ์ด์์ ๋ฒ์ ๋ถํฐ ์ ๋ฏธ์ฌ๋ฅผ ์ญ์ ํ์ฌ์ผ ํฉ๋๋ค.
Spring Cloud์ด ๊ธฐ์กด์ ์ ๊ณตํ์๋ Greenwich, Hoxton ๋ฐฉ์์ ๋ฒ์ ๋ช
์ ์ ๊ฑฐํ๊ณ
Calander ํ์์ผ๋ก ์ ๊ณตํ์ฌ 2020.0.0 ํํ์ ๋ฒ์ ๋ช
์ผ๋ก ์ ๊ณต๋ฉ๋๋ค.
JUnit์ด 5๋ฒ์ ๋ง ์ ๊ณต๋๋ฉฐ ๊ธฐ์กด์ JUnit4๋ฅผ ์ฌ์ฉ ํ ์ ์๋ ์ต์ ์ธ Vintage๊ฐ ์ ๊ฑฐ ๋์์ต๋๋ค. ๋ฐ๋ผ์ JUnit4๋ฅผ ๊ณ์ ์ฌ์ฉํ์ค ๊ฒฝ์ฐ์๋ ์๋์ ๊ฐ์ด ์ถ๊ฐ์ ์ธ ๋ํ๋์๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
<!-- maven -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>// Gradle
testImplementation("org.junit.vintage:junit-vintage-engine") {
exclude group: "org.hamcrest", module: "hamcrest-core"
}์๋นํ ๋ง์ด ๋ณ๊ฒฝ๋์ด ์ด ์ฑํฐ๊ฐ ์๋ ๋ค๋ฅธ ์ฑํฐ์ ๋ด์ ์์ ์ ๋๋ค. ์ด์ ์ ์ค์ ์ ๊ทธ๋๋ก ์ฌ์ฉํ๊ณ ์ถ์ ๊ฒฝ์ฐ์๋ ์๋์ ๊ฐ์ด ์ค์ ํ์ผ์ ๋ช ์ํด์ฃผ๋ฉด ์ด์ ๋ฒ์ ๊ณผ ๊ฐ์ด ์ฌ์ฉ์ด ๊ฐ๋ฅํฉ๋๋ค.
spring-config.use-legacy-processing=true์ธ๋ถ์์ ์ฌ์ฉํ๋ ์ค์ ์ ์ฌ์ฉํ ๊ฒฝ์ฐ์๋ spring.cloud.location๋ฅผ ๋ช
์ํด์ฃผ์ด์ผ ํฉ๋๋ค.
Optional์ด ์๋ Mandantory๋ก ์ค์ ์ด ๋์ด์์ด์ ์๊ธฐ๋ ์ค๋ฅ์ธ๋ฐ Optional๋ก ๋ณ๊ฒฝ์ด ํ์ํ ๊ฒฝ์ฐ์๋
spring.cloud.location:optional:{url} ์ฒ๋ผ Optionalํ๊ฒ ๋ณ๊ฒฝ์ด ๊ฐ๋ฅํฉ๋๋ค.
์๋๋ ์คํ๋ง๋ถํธ์์ ์ฌ์ฉํ DB๋ Datasource๋ฅผ ์ ๋ ฅํ์ง ์์ ๊ฒฝ์ฐ ์๋์ผ๋ก ๋ฉ๋ชจ๋ฆฌ ๋๋น๋ก ๋ง๋ค์ด ์ฃผ์๋๋ฐ ์ด์ ๋ ์ง์ ์ ๋ ฅํด์ผ ํฉ๋๋ค.
datasource๋ฅผ ๋ง๋ค๋ ํด์ฃผ๋ sa๋ ์ด์ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ์์ฑํด์ฃผ์ง ์์ผ๋ฉฐ spring.datasource.username=sa ์ฒ๋ผ ๋ช
์๋ฅผ ํด์ฃผ์ด์ผ ํฉ๋๋ค.
์๋์ ๊ฐ์ด ๋ช ์ํ์ฌ ์ด์ ์ค์ ์ฒ๋ผ ๋์ํ๊ฒ ํ ์ ์์ต๋๋ค.
spring.datasource.initialization-mode=always๋ค์ Spring Boot ์์ฑ์ด ๋ณ๊ฒฝ๋์์ต๋๋ค.
logging.pattern.rolling-file-nameโlogging.logback.rollingpolicy.file-name-patternlogging.file.clean-history-on-startโlogging.logback.rollingpolicy.clean-history-on-startlogging.file.max-sizeโlogging.logback.rollingpolicy.max-file-sizelogging.file.total-size-capโlogging.logback.rollingpolicy.total-size-caplogging.file.max-historyโlogging.logback.rollingpolicy.max-history
๋งคํ๋๋ ์์คํ ํ๊ฒฝ ์์ฑ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
ROLLING_FILE_NAME_PATTERNโLOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERNLOG_FILE_CLEAN_HISTORY_ON_STARTโLOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_STARTLOG_FILE_MAX_SIZEโLOGBACK_ROLLINGPOLICY_MAX_FILE_SIZELOG_FILE_TOTAL_SIZE_CAPโLOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAPLOG_FILE_MAX_HISTORYโLOGBACK_ROLLINGPOLICY_MAX_HISTORY
๊ธฐ๋ณธ์ผ๋ก ์ ๊ณต๋๋ Setvlet์ DispatcherServlet๋ง ์ฌ์ฉ์ด๋๋ฉฐ DefaultServlet์ ์ฌ์ฉํ๊ธฐ ์ํด์๋ ์ถ๊ฐ๋ก ์ค์ ์ ํด์ฃผ์ด์ผ ํฉ๋๋ค.
server.servlet.register-default-servlet=trueFlyway 5๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๋ฆด๋ฆฌ์ค์ ๋ํ ์คํค๋ง ์
๊ทธ๋ ์ด๋ ๋ง ์ง์๋๋ฉฐ Spring Boot 2.4๋ฅผ ์ฌ์ฉํ ๊ฒฝ์ฐ์๋ Flyway 6์ผ๋ก ์
๊ทธ๋ ์ด๋๊ฐ ํ์ํฉ๋๋ค.
@ConstructorBinding๋ฅผ ์ด์ฉํ์ฌ ๊ธฐ์กด์ ํ์์์๋ Setter๋ฅผ ๋ช
์ ์ํด๋ ๋ฉ๋๋ค.
gradle์ spring-boot-properties-migrator๋ฅผ ์ถ๊ฐํ๊ณ ์คํํ๋ฉด ์์์ผํ ์ค์ ๋ค์ ์๋ ค์ฃผ๊ฑฐ๋ ๋์ฒดํ ํญ๋ชฉ์ ์๋ดํด์ค๋ค.
properties์ ์๋ ๊ฐ์ ๋ฐ๋ก Durationd์ผ๋ก ์ฌ์ฉ์ด ๊ฐ๋ฅํ๋ค.
1s, 1h, 1m ๊ณผ ๊ฐ์ ๋จ์๋ฅผ ์ฌ์ฉ ๊ฐ๋ฅํ๋ฉฐ
1์ด๋ผ๊ณ ์ง์ ์ ํด๋๊ณ @DurationUnit(CronoUnit.SECONDS) ํํ๋ก ์ง์ ์ด ๊ฐ๋ฅ
properties์์ ๊ฐ์ ธ์ฌ key๊ฐ์ด ์์ฝ์ด์ผ ๊ฒฝ์ฐ @Name ์ผ๋ก ๊ฐ์ ธ์ฌ ์ ์๋ค.