๐Ÿšš

Common Application Properties

 

์ฐธ๊ณ  ๊ณต์‹๋ฌธ์„œ

Server Properties

server: error: include-exception : ์˜ค๋ฅ˜ ์‘๋‹ต์— exception์˜ ๋‚ด์šฉ์„ ํฌํ•จํ• ์ง€ ์—ฌ๋ถ€ (TRUE, FALSE) include-stacktrace : ์˜ค๋ฅ˜ ์‘๋‹ต์— stacktrace ๋‚ด์šฉ์„ ํฌํ•จํ• ์ง€ ์—ฌ๋ถ€ (ALWAYS, NEVER, ON_TRACE_PARAM) path : ์˜ค๋ฅ˜ ์‘๋‹ต์„ ์ฒ˜๋ฆฌํ•  ํ•ธ๋“ค๋Ÿฌ(ErrorController)์˜ path whitelabel.enabled : ๋ธŒ๋ผ์šฐ์ € ์š”์ฒญ์— ๋Œ€ํ•ด ์„œ๋ฒ„ ์˜ค๋ฅ˜์‹œ ๊ธฐ๋ณธ์œผ๋กœ ๋…ธ์ถœํ•  ํŽ˜์ด์ง€๋ฅผ ์‚ฌ์šฉํ• ์ง€ ์—ฌ๋ถ€ (TRUE, FALSE) servlet.context-path : /gw # Controller RequestMapping ์•ž์— url prefix ์„ค์ • ์ถœ์ฒ˜: https://goddaehee.tistory.com/214 [๊ฐ“๋Œ€ํฌ์˜ ์ž‘์€๊ณต๊ฐ„]
 

Data Properties

spring.jpa

์ฐธ๊ณ  configuration

//application.yml spring: h2: console: enabled: true jpa: show-sql: true hibernate: ddl-auto: create-drop properties: hibernate: format_sql: true database: mysql generate-ddl: true datasource: url: jdbc:mysql://localhost:3306/book_manager?serverTimezone=Asia/Seoul //url : ์‚ฌ์šฉํ• api:์–ด๋–คdb์‚ฌ์šฉํ• ์ง€://url์ฃผ์†Œ/์‚ฌ์šฉํ•  database๋ช… username: root password: geunomysql!@#$ initialization-mode : always // h2๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” ์ด ์˜ต์…˜ ์„ค์ •ํ•ด์ฃผ์ง€ ์•Š์•„๋„ ์ž๋™์œผ๋กœ // data.sql๊ณผ schema.sql๋ฅผ ์‹คํ–‰์‹œ์ผœ์คŒ. ๊ทธ๋Ÿฌ๋‚˜ Mysql์—์„œ๋Š” ๊ทธ๋ ‡์ง€ ์•Š๊ธฐ์— ์„ค์ •ํ•ด์ฃผ์–ด์•ผํ•จ // ๋˜ํ•œ ์—ฌ๊ธฐ์„œ schema.sql์„ ์‹คํ–‰ํ•˜๋Š”๊ฒƒ์ด ddl์ด๊ธฐ ๋•Œ๋ฌธ์— ddl-auto ์˜ต์…˜๊ณผ ๊ฒน์นจ // schema.sql์„ ๋” ์šฐ์„ ์‹œํ•˜๊ฒŒ ๋จ ```
 

open-in-view [์ฐธ๊ณ ]

notion image
  • ์ปจํŠธ๋กค๋Ÿฌ์™€ ๋ทฐ๊นŒ์ง€ ์˜์†์„ฑ ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•˜๋Š” ๊ฒƒ
Register OpenEntityManagerInViewInterceptor. Binds a JPA EntityManager to the thread for the entire processing of the request.
  • OSIV(Open Session In View)๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜๋ฉด ์›ํ•˜์ง€ ์•Š๋Š” ์ƒํ™ฉ์—์„œ ์ฟผ๋ฆฌ๊ฐ€ ๋‚˜๊ฐˆ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ฃผ์˜ํ•ด์•ผํ•จ
  • ๋ณดํ†ต์€ entity๋Š” Transactional ์•ˆ์—์„œ๋งŒ ๊ด€๋ฆฌํ•˜๊ฒŒ ํ•˜๊ณ  ๊ทธ ์™ธ์˜ ๋ ˆ์ด์–ด์—์„œ๋Š” DTO๋ฅผ ๋งŒ๋“ค์–ด์„œ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Œ โ‡’ Service์—์„œ ๋ฐ˜ํ™˜ํ•  ๋•Œ entity๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹Œ entity์˜ id๋งŒ์„ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ˜•ํƒœ๋กœ. ํ˜น์€ dto๋ฅผ ๋ฐ˜ํ™˜
    • ์›์น˜ ์•Š๋Š” ๊ณณ์—์„œ ์—”ํ‹ฐํ‹ฐ์˜ ์กฐ์ž‘์ด ์ผ์–ด๋‚˜์ง€ ์•Š๋„๋ก(์ฟผ๋ฆฌ๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก)

spring.jpa.properties.*

Additional native properties to set on the JPA provider(Jpa vendor etc. EclipseLink Hibernate)
Hibernate Performance Tuning

spring.jpa.generate-ddl

๐Ÿ‘๐Ÿป
Initialize a Database Using JPA
 

spring.jpa.hibernate.dialect

  • dialect๋Š” JPA์—์„œ ์ฟผ๋ฆฌ ์ƒ์„ฑํ•  ๋•Œ ์–ด๋–ค ์ฟผ๋ฆฌ๋ฌธ์œผ๋กœ ์ƒ์„ฑํ•  ์ง€๋ฅผ ์ •ํ•ด์ฃผ๋Š” ์†์„ฑ์ž„

DataMigration Properties

spring.sql

spring: sql: init: platform: h2 schema-locations: classpath:sql/schema.sql data-locations: classpath:sql/data.sql encoding: UTF-8