참고 공식문서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