본문 바로가기

스프링

스프링 부트 따라하기-2 (디비연결 및 세팅)

plugins {
	id 'org.springframework.boot' version '2.4.0'
	id 'io.spring.dependency-management' version '1.0.10.RELEASE'
	id 'java'
}

group = 'com.board'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations {
	compileOnly {
		extendsFrom annotationProcessor
	}
}

repositories {
	mavenCentral()
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	compileOnly 'org.projectlombok:lombok'
	runtimeOnly 'org.postgresql:postgresql'
	annotationProcessor 'org.projectlombok:lombok'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
	runtimeOnly 'org.webjars:bootstrap:4.5.2'
	
}

test {
	useJUnitPlatform()
}

gradle 의존설정 - mvnrepository에 있는 대로 갖다 쓰면 에러남

compile group: 'org.webjars', name: 'bootstrap', version: '4.5.2' 같은식으로 되어있는데 name version같은 거 나누지 말고 콜론(:)으로 구분해야한다. 

 

spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:postgresql://localhost:5432/board?serverTimezone=Asia/Seoul&characterEncoding=UTF-8
spring.datasource.username=유저명
spring.datasource.password=비밀번호

디비와 연결, postgresql을 쓰고 board란 이름을 가지는 스키마로 연결