implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
jpa를 사용하기 위해서 Spring Data JPA 의존성을 추가한 후 애플리케이션을 실행했을때 아래와 같은 에러가 발생했다
문제 상황
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
위에 내용을 한국어로 번역했을때
설명 (Description)
DataSource를 설정하지 못했습니다:
url 속성이 지정되지 않았고, 내장 데이터베이스도 설정할 수 없습니다.
원인 (Reason)
적절한 데이터베이스 드라이버 클래스를 찾지 못했습니다.
조치 (Action)
다음 사항을 확인하세요:
H2, HSQL, Derby 같은 내장 DB를 사용하려면 해당 라이브러리를 classpath에 추가하세요.
특정 Spring profile에서 DB 설정을 로딩하도록 되어 있다면,
해당 profile을 활성화해야 할 수 있습니다 (현재는 활성화된 profile이 없습니다).
원인
Spring Data JPA 의존성 추가시 아래와 같이 동작하는데
- JPA(Hibernate) 자동 설정
- EntityManagerFactory 생성 시도
- DataSource 자동 설정 시도
- 트랜잭션 매니저 설정
'복습 프로젝트' 카테고리의 다른 글
| 복습 프로젝트 (2) 스프링부트4.x에서 h2-console웹 오류 (0) | 2026.01.05 |
|---|---|
| 프로젝트 계획 (0) | 2026.01.01 |