티스토리 뷰
Error
[Error] Error creating bean with name '~': Unsatisfied dependency expressed through constructor parameter 0; nested exception is
onlog writer 2023. 4. 13. 09:45
에러 원인 : Spring Bean 생성 에러
에러 로그
Error creating bean with name 'boardController' defined in file
[/Users/daon/git/springboot-jpa-project/build/classes/java/main
/com/example/jpa/controller/BoardController.class]:
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'boardService' defined in file
[/Users/daon/git/springboot-jpa-project/build/classes/java/main
/com/example/jpa/service/BoardService.class]:
Unsatisfied dependency expressed through constructor parameter 0;
nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'boardRepository' defined in
com.example.jpa.repository.BoardRepository defined in @EnableJpaRepositories
declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration:
Invocation of init method failed;
nested exception is java.lang.IllegalArgumentException:
This class [class com.example.jpa.entity.BaseEntity] does not define an IdClass
해당 에러는 '빈 생성시에 필요한 것이 빠졌거나, 잘못되었으니 고쳐라' 라는 에러를 뱉고 있다.
로그에서 알려주는 클래스에서 어노테이션이나 지정해준 것을 확인해봤더니 BoardRepository에서 아래와 같이 <BoardEntity, Long> 으로 지정해줘야 하는 것을 BoardEntity 대신에 BaseEntity로 지정해서 빈 생성이 되지 않았던 것이었다.
import com.example.jpa.entity.BoardEntity;
import org.springframework.data.jpa.repository.JpaRepository;
public interface BoardRepository extends JpaRepository<BoardEntity, Long> {
}
다시 알맞게 수정을 하고 실행을 했더니 (hibernate는 create로 실행함)
// application.yml
hibernate:
ddl-auto: update
drop된 후 다시 create table이 잘 만들어졌다.
실행이 잘 된 것을 보고 application.yml 은 update로 다시 변경해주었다.
테이블 생성 화면
'Error' 카테고리의 다른 글
[GitHub Error] Push of the current branch "master" was rejected. Remote changes need to be merged before pushing. (0) | 2023.04.12 |
---|---|
[Error] No candidates found for method call (0) | 2023.03.14 |
[Error] java: cannot find symbol (0) | 2023.02.24 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 변수
- alert focus
- 자바 출력 속도
- alert
- Scanner 시간초과
- MsgBox순서
- dataGridView
- focus 작동 안하는 경우
- BufferdReader 클래스
- System.out.println
- 출력 메소드
- 출력 스트림
- 변수의 종류
- I/O
- 자바 입출력
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함