์Šคํ”„๋ง ์ด๋‹ˆ์…œ๋ผ์ด์ €๋ฅผ ํ†ตํ•ด์„œ ์Šคํ”„๋ง ๋ถ€ํŠธ ๊ธฐ๋ฐ˜์˜ ํ”„๋กœ์ ํŠธ ํด๋”๋ฅผ ๊ตฌ์„ฑํ•˜๋”๋ผ๋„ ํšŒ์‚ฌ๋งˆ๋‹ค ํ˜น์€ ๊ฐœ๋ฐœ์ž๋งˆ๋‹ค ๋„ˆ๋ฌด๋‚˜๋„ ๋‹น์—ฐํ•˜๊ฒŒ ํ•˜๋Š” ๊ฒƒ๋“ค์ด ์กฐ๊ธˆ์”ฉ ์žˆ๊ธฐ ๋งˆ๋ จ์ด๋‹ค. ์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๊ณ ๋‚˜์„œ ๋„ˆ๋ฌด๋‚˜๋„ ๋‹น์—ฐํ•˜๊ฒŒ ์Šต๊ณผ์ ์œผ๋กœ ๋งค๋ฒˆ ํ•˜๋Š” ๊ฒƒ๋“ค์— ๋Œ€ํ•ด์„œ ์ •๋ฆฌํ•ด๋ณด๊ณ ์ž ํ•œ๋‹ค.

1. Properties๊ฐ€ ์•„๋‹Œ YAML ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝํ•˜๊ธฐ

์Šคํ”„๋ง ์ด๋‹ˆ์…œ๋ผ์ด์ €๋ฅผ ํ†ตํ•ด์„œ ๋งŒ๋“ค์–ด์ง„ ๊ธฐ๋ณธ์ ์ธ ํ”„๋กœ์ ํŠธ ํด๋”์—๋Š” application.properties ํŒŒ์ผ์ด ์กด์žฌํ•œ๋‹ค. ์Šคํ”„๋ง ๋ถ€ํŠธ์—์„œ๋Š” Java Properties, YAML ๊ทธ๋ฆฌ๊ณ  ํ™˜๊ฒฝ ๋ณ€์ˆ˜๋ฅผ ํ†ตํ•ด์„œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋กœํผํ‹ฐ ์†์„ฑ ๊ฐ’์„ ์ ์šฉํ•˜์—ฌ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ์ง€์›ํ•œ๋‹ค. ํ•˜์ง€๋งŒ, ISO-8859-1 ์ธ์ฝ”๋”ฉ์œผ๋กœ ๊ฐ•์ œ๋˜๋Š” ์ž๋ฐ” ํ”„๋กœํผํ‹ฐ ํŒŒ์ผ์—๋Š” ํ•œ๊ณ„๊ฐ€ ์žˆ๊ณ  ๋Œ€๋ถ€๋ถ„์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ UTF-8์„ ์‚ฌ์šฉํ•˜๋Š” ํŽธ์ด๋ฏ€๋กœ YAML ๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์ด ํŽธ๋ฆฌํ•˜๋‹ค.

It is recommended to stick with one format for your entire application. If you have configuration files with both .properties and .yml format in the same location, .properties takes precedence.

์œ„์™€ ๊ฐ™์ด ๊ณต์‹ ๋ฌธ์„œ์— ๋‚˜์™€์žˆ๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ํ”„๋กœํผํ‹ฐ์™€ ์•ผ๋ฏˆ ํŒŒ์ผ์„ ๋™์‹œ์— ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ์ž๋ฐ” ํ”„๋กœํผํ‹ฐ ํŒŒ์ผ์„ ์šฐ์„ ํ•˜์—ฌ ์ ์šฉํ•˜๋ฏ€๋กœ ์ฃผ์˜ํ•˜์ž.

2. ์Šคํ”„๋ง ๋ถ€ํŠธ ๊ธฐ๋ณธ ๋ฐฐ๋„ˆ ์˜ต์…˜ ๋„๊ธฐ

๋‘๋ฒˆ์งธ๋กœ ํ•˜๋Š” ์ผ์€ ์Šคํ”„๋ง ๋ถ€ํŠธ์—์„œ ์ œ๊ณตํ•˜์—ฌ ์ฝ˜์†”์— ํ‘œ์‹œ๋˜๋Š” ๊ธฐ๋ณธ ๋ฐฐ๋„ˆ ๋กœ๊ทธ๋ฅผ ๋น„ํ™œ์„ฑํ™”ํ•˜๋Š” ๊ฒƒ์ด๋‹ค. ๋Œ€๋ถ€๋ถ„์˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ์Šคํ”„๋ง ๋ฐฐ๋„ˆ๋ฅผ ํ†ตํ•ด์„œ ๋ฒ„์ „์„ ํ™•์ธํ•  ํ•„์š”์„ฑ์€ ๊ต‰์žฅํžˆ ์ ์œผ๋ฉฐ ์ค‘์š”์‹œ ํ•ด์•ผํ•˜๋Š” ๊ฒƒ์€ ๋นŒ๋“œ ์ •๋ณด์ผ ๋ฟ์ด๊ธฐ์— ๋ถˆํ•„์š”ํ•˜๋‹ค.

application.yml
spring.main.banner-mode: off

3. ๊ทธ๋ž˜๋“ค ๋กฌ๋ณต ํŒจํ‚ค์ง€ ๊ตฌ์„ฑ์„ ๋กฌ๋ณต ํ”Œ๋Ÿฌ๊ทธ์ธ์œผ๋กœ ๋ณ€๊ฒฝํ•˜๊ธฐ

๊ทธ๋ž˜๋“ค ๊ธฐ๋ฐ˜์œผ๋กœ ์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒฝ์šฐ ๊ทธ๋ž˜๋“ค ๋กฌ๋ณต ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ์•„๋‹Œ ์ง์ ‘ ํŒจํ‚ค์ง€๋ฅผ ๋””ํŽœ๋˜์‹œ์— ์ง€์ •ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๋˜์–ด์žˆ๋‹ค. io.freefair.lombok์„ ํ”Œ๋Ÿฌ๊ทธ์ธ์œผ๋กœ ๋“ฑ๋กํ•˜์—ฌ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๋” ํšจ์œจ์ ์ด๋‹ค.

build.gradle
plugins { id 'io.freefair.lombok' version '8.0.1' }

4. ๊ธฐ๋ณธ ํ†ฐ์บฃ ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์–ธ๋”ํ† ์šฐ๋กœ ๋Œ€์ฒดํ•˜๊ธฐ

์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ์—์„œ ๊ธฐ๋ณธ์ ์œผ๋กœ ์˜์กดํ•˜๋Š” ์ž„๋ฒ ๋””๋“œ ํ†ฐ์บฃ๋„ ์ค€์ˆ˜ํ•œ ์„ฑ๋Šฅ์„ ๋ณด์—ฌ์ฃผ์ง€๋งŒ ์ž๋ฐ”๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ NIO ๊ธฐ๋ฐ˜์œผ๋กœ ์ž‘์„ฑ๋œ ๊ฒฝ๋Ÿ‰์˜ ์›น ์„œ๋ฒ„ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ธ ์–ธ๋”ํ† ์šฐ๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค. ์›น ์Šคํƒ€ํ„ฐ ๋ชจ๋“ˆ์—๋Š” ํ†ฐ์บฃ์— ๋Œ€ํ•œ ์˜์กด์„ฑ์ด ํฌํ•จ๋˜์–ด์žˆ์œผ๋ฏ€๋กœ ์•„๋ž˜์™€ ๊ฐ™์ด ํ†ฐ์บฃ์— ๋Œ€ํ•œ ๋ชจ๋“ˆ์€ ์ œ์™ธ๋˜๋„๋ก ํ•˜์ž.

build.gradle
configurations.configureEach { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat' } dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-undertow' }

์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ 6.1 ์—์„œ๋Š” JDK 21๊ณผ Virtual Threads๋ฅผ ์šฐ์„ ์ ์œผ๋กœ ํ†ฐ์บฃ์—์„œ ์ง€์›ํ•  ์˜ˆ์ •์ธ ๊ฒƒ ๊ฐ™์•„ ์–ธ๋”ํ† ์šฐ๊ฐ€ ์•„๋‹Œ ํ†ฐ์บฃ์„ ์„ ํƒํ•ด์•ผํ•  ๊ฒฝ์šฐ๊ฐ€ ๋  ๊ฐ€๋Šฅ์„ฑ๋„ ๋ณด์ธ๋‹ค. ๊ด€๋ จ ํ”„๋กœ์ ํŠธ: mp911de/spring-boot-virtual-threads-experiment

5. ์ธํ…”๋ฆฌ์ œ์ด IDEA์˜ ๋นŒ๋“œ ๋ฐ ์‹คํ–‰ ์˜ต์…˜ ๋ณ€๊ฒฝํ•˜๊ธฐ

๋งˆ์ง€๋ง‰์œผ๋กœ ์ธํ…”๋ฆฌ์ œ์ด IDEA๋ฅผ ํ†ตํ•ด์„œ ์Šคํ”„๋ง ๋ถ€ํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ๋นŒ๋“œํ•˜๊ณ  ์‹คํ–‰ํ•˜๋Š” ๊ฒฝ์šฐ ์ปดํŒŒ์ผ๋Ÿฌ์™€ ๊ทธ๋ž˜๋“ค์— ๋Œ€ํ•œ ์˜ต์…˜์„ ๋ณ€๊ฒฝํ•˜๋Š” ๊ฒƒ์ด ๋” ํšจ์œจ์ ์œผ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ฐœ๋ฐœํ•˜๊ณ  ์‹คํ–‰ํ•˜๋Š” ํ™˜๊ฒฝ์ด ๋˜๋ฏ€๋กœ ์ ์šฉํ•˜๋Š” ํŽธ์ด๋‹ค.

  • Build, Execution, Deployment > Build Tools > Gradle > Build and run using Intellij IDEA
  • Build, Execution, Deployment > Build Tools > Compiler > Build project automatically

๊ธฐ๋ณธ Gradle์ด ์•„๋‹Œ Intellij IDEA๋กœ ๋นŒ๋“œ ๋ฐ ์‹คํ–‰์„ ํ•˜๋„๋ก ์„ค์ •ํ•œ๋‹ค๋ฉด ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ ํด๋”์— out ์ด๋ผ๋Š” ์ด๋ฆ„์˜ ํด๋”์— ํ˜„์žฌ ์‹คํ–‰์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ๋Œ€ํ•œ ํด๋ž˜์Šค ํŒŒ์ผ๊ณผ ์ •์  ๋ฆฌ์†Œ์Šค ํŒŒ์ผ๋“ค์ด ์ด๋™๋˜์–ด ์–ด๋– ํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์„ ๋•Œ ๊ณง๋ฐ”๋กœ ์‚ดํŽด๋ณผ ์ˆ˜ ์žˆ๋‹ค.