์ฐธ๊ณ ๊ณต์๋ฌธ์Server PropertiesData Propertiesspring.jpa์ฐธ๊ณ configurationopen-in-view [์ฐธ๊ณ ]spring.jpa.properties.*spring.jpa.generate-ddlspring.jpa.hibernate.dialectDataMigration Propertiesspring.sql
์ฐธ๊ณ ๊ณต์๋ฌธ์
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 [์ฐธ๊ณ ]

- ์ปจํธ๋กค๋ฌ์ ๋ทฐ๊น์ง ์์์ฑ ์ํ๋ฅผ ์ ์งํ๋ ๊ฒ
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.*
Hibernate Performance TuningAdditional native properties to set on the JPA provider(Jpa vendor etc. EclipseLink Hibernate)
spring.jpa.generate-ddl
Initialize a Database Using JPAspring.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