생성 방법은 여기 참조!
plugins {
id 'org.springframework.boot' version '2.5.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.rptp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
runtimeOnly 'mysql:mysql-connector-java'
}
test {
useJUnitPlatform()
}
DB는 Mysql을 사용할 예정이다. 왜 싸지방에서는 H2가 안깔리는거야 ㅠㅠ
spring.datasource.url=jdbc:mysql://localhost:3306/board?serverTimezone=UTC&characterEncoding=UTF-8
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=1234
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
db에 관한 설정들이다.
DB의 연결주소를 작성하면 된다. mysql에서 schema를 생성하고 {board} 부분을 지운 후 생성한 스키마명을 넣으면 된다.
DB사용자의 이름과 비밀번호를 입력하면 된다.
jpa가 실행될 때 sql쿼리를 콘솔에 출력하는지 여부이다
sql문 중 DDL(Data Definition Language)문 생성 옵션이다.
https://pravusid.kr/java/2018/10/10/spring-database-initialization.html