spring:
thymeleaf:
cache: false # 타임리프 캐시 끄기
prefix: file:src/main/resources/templates/ # 타임리프 캐시 끄기(이 설정을 해야 꺼짐)
devtools:
livereload:
enabled: true
restart:
enabled: true
datasource:
driver-class-name: org.mariadb.jdbc.Driver
url: jdbc:mariadb://127.0.0.1:3306/<미리 생성한 DB 이름>?useUnicode=true&characterEncoding=utf8&autoReconnect=true&serverTimezone=Asia/Seoul
username: <DB username>
password: <DB password>
jpa:
hibernate:
ddl-auto: create # DB 테이블 자동생성(엔티티 클래스만 만들면 됨)
@Entity
를 붙여주면 된다.@Id
를 붙여준다. import jakarta.persistence.Entity;
import jakarta.persistence.Id;
@Entity
public class Article {
@Id
private long id;
private String title;
private String body;
}
DB에 들어가보면
완료!