인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

인프런 커뮤니티 질문&답변

richthofen4852님의 프로필 이미지
richthofen4852

작성한 질문수

스프링 DB 2편 - 데이터 접근 활용 기술

Error creating bean with name 'itemController'

작성

·

652

0

[질문 내용]
안녕하세요. 강사님 수업을 잘 듣고 있습니다.
Jpa 부분의 강의까지는 별 탈 없이 진행이 되었는데 오늘 Spring Data Jpa 강의를 듣고
테스트를 돌리는 과정 중에
java.lang.IllegalStateException: Failed to load ApplicationContext 와
Error creating bean with name 'itemController' Unsatisfied dependency expressed through constructor parameter 0; 라는
에러가 나타나게 되었습니다. itemController의 빈 생성이 정상적으로 된 것 같지는 않아 itemConroller 부분의 @Controller 어노테이션과
@RequiredArgumentConstructor 어노테이션이 정상적으로 존재하는지 확인도 해보았지만 빠져있지는 않았습니다.
혹여나 Spring Data Jpa 부분에서 제가 무언가를 잘못 타이핑 한건가 싶어 어제까지는 정상적으로 작동하였던 JpaConfig 파일을 ItemServerApplicaton에 Import 해보았으나 동일한 에러가 나타났습니다.
구글링을 통해서도 정보를 찾아보았지만 해결이 잘 안되는데 이런 상황에서는 어떻게 해결하여야 하는지 알려주시면 감사하겠습니다.

 

답변 2

0

안녕하세요. richthofen4852님, 공식 서포터즈 OMG입니다.

findByItemNameLikePriceLessThanEqual
findByItemNameLikeAndPriceLessThanEqual

 

해당 오류는 

SpringDataJpaItemRepository의 코드를 변경해주세요  :)

 

감사합니다.

감사합니다!!

0

안녕하세요. richthofen4852님, 공식 서포터즈 OMG입니다.

아래 링크를 보시면 아시겠지만, 올리신 에러메시지 뒤에 추가적인 에러메시지가 있을 거같아요.

through constructor parameter 0;

뒤에 추가 에러메시지를 확인하여 해결해주세요.

해결이 안될 경우 댓글남겨주세요

 

https://www.inflearn.com/questions/255359

 

감사합니다.

안녕하세요 답변 링크를 보고 뒷 부분의 추가 에러 메시지를 보았는데

Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'hello.itemservice.config.SpringDataJpaConfig': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException 이렇게 출력되었습니다.

@Configuration
@RequiredArgsConstructor
public class SpringDataJpaConfig {

private final SpringDataJpaItemRepository springDataJpaItemRepository;

@Bean
public ItemService itemService() {
return new ItemServiceV1(itemRepository());
}

@Bean
public ItemRepository itemRepository() {
return new JpaItemRepositoryV2(springDataJpaItemRepository);
}

}

 

강의와 다른 부분이 있는지 확인해주시고, 그래도 해결이 안될 경우 코드를 살펴봐야 알 것 같습니다.


전체 프로젝트를 압축해서 구글 드라이브로 공유해서 링크를 남겨주세요.
구글 드라이브 업로드 방법은 다음을 참고해주세요.

https://bit.ly/3fX6ygx

주의: 업로드시 권한 문제 꼭 확인해주세요
공유 기본 설정은 비공개로 되어 있어 업로드 한 본인 계정만 접근이 가능합니다.

본인 계정이 아닌 링크를 통한 타 계정 접근이 가능한지 확인하는 방법은 업로드 한 구글 계정을 로그아웃하고 링크를 접속하여 "액세스 권한 요청 화면"이 출력되는지 확인을 해주세요.

감사합니다

https://drive.google.com/file/d/1be_uz0JP84kvBbOxzAzLZBB2lSG4GpD2/view?usp=sharing 링크 올려드렸습니다!

richthofen4852님의 프로필 이미지
richthofen4852

작성한 질문수

질문하기