Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- 리눅스
- GIT
- 서버설정
- 처음 만나는 AI수학 with Python
- d
- 처음 만나는 AI 수학 with Python
- 데비안
- 코드로배우는스프링부트웹프로젝트
- 목록처리
- 알파회계
- Kernighan의 C언어 프로그래밍
- 코드로배우는스프링웹프로젝트
- resttemplate
- 자료구조와함께배우는알고리즘입문
- 스프링 시큐리티
- 티스토리 쿠키 삭제
- 자바편
- 친절한SQL튜닝
- 네트워크 설정
- 구멍가게코딩단
- 스프링부트핵심가이드
- /etc/network/interfaces
- iterator
- network configuration
- 이터레이터
- ㅒ
- 선형대수
- 자료구조와 함께 배우는 알고리즘 입문
- baeldung
- 페이징
Archives
- Today
- Total
bright jazz music
[bootBoard] N:1(다대일) 연관관계: 2. 프로젝트 생성 본문
● bootboard라는 이름의 프로젝트 생성하여 다대일 연관관계를 실습하자
1. 프로젝트 생성
2. DB연결 설정(build.gradle & application.properties)
2-1. build.gradle 설정 추가
- mariadb-java-client (jdbc)
- thymeleaf-extras-java8time (타임리프의 시간 처리 관련 라이브러리)
- 수정 후 gradle refresh 필수!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//build.gradle
plugins {
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'java'
id 'war'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
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'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.projectlombok:lombok'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
//compile groudp: 'org.mariadb.jdbc', name: 'mariadb-java-client' 책에는 이렇게 쓰여 있다. compile은 depricated되었다.
//따라서 아래와 같이 써준다.
implementation('org.mariadb.jdbc:mariadb-java-client')
implementation('org.thymeleaf.extras:thymeleaf-extras-java8time')
}
tasks.named('test') {
useJUnitPlatform()
}
2-2 application.properties에 JPA설정 추가
3. 프로젝트 구동(Run)
아래와 같은 에러 나는 경우 build.gradle을 refresh해볼 것.
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Cannot load driver class: org.mariadb.jdbc.Driver
4. 구동 완료 확인
'Framework > Spring' 카테고리의 다른 글
[bootBoard] N:1(다대일) 연관관계: 4. @ManyToOne 어노테이션 추가 (0) | 2022.07.26 |
---|---|
[bootBoard] N:1(다대일) 연관관계: 3. 프로젝트 구성 요소 작성(추가) (0) | 2022.07.26 |
[bootBoard] N:1(다대일) 연관관계: 1.연관관계와 DB 설계 (0) | 2022.07.25 |
guestbook: 11. 검색처리(3) (0) | 2022.07.24 |
guestbook : 11. 검색처리(2) (0) | 2022.07.23 |
Comments