아래와 같이 임시로 db를 연결해준다.
datasource:
url: jdbc:h2:mem:testdb
username: sa
driver-class-name: org.h2.Driver
에러메세지:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
해결: 테스트 어노테이션을 @WebMvcTest 이 아닌, @AutoConfigureMockMvc 와 @SpringBootTest 로 수정.
data rest 테스트는 인테그레이션으로 접근할 수 밖에 없음.
DB 접근이 일어나는 곳에 롤백 정책을 위하여 @Transactional 롤백을 위한 어노테이션을 적용.
Querydsl 설정
// Querydsl 설정부
def generated = 'src/main/generated'
// querydsl QClass 파일 생성 위치를 지정
tasks.withType(JavaCompile) {
options.getGeneratedSourceOutputDirectory().set(file(generated))
}
// java source set 에 querydsl QClass 위치 추가
sourceSets {
main.java.srcDirs += [ generated ]
}
// gradle clean 시에 QClass 디렉토리 삭제
clean {
delete file(generated)
}
위 처럼 설정 했더니,
Unable to load class 'javax.persistence.Entity'.
This is an unexpected error. Please file a bug containing the idea.log file.
라는 에러 발생
이유: 버전 변경으로 인함