SP'S SPARKING

해결 "this.custRepository" is null 본문

HAPPYHACKING/ERROR SOLVED

해결 "this.custRepository" is null

SPSP 2024. 7. 13. 11:10

문제 상황:

CardController 에서 CustomerRepository를 선언하여 getOne을 사용했는데, 에러

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Dec 08 10:49:43 EST 2021

There was an unexpected error (type=Internal Server Error, status=500).

Cannot invoke "com.spring.web.repository.CustomerRepository.getOne(Object)" because "this.custRepository" is null

해결:

CardContorller 에서 CustomerRepository를 선언하기 이해 정의할 때,

private CustomerRepository custRepository;

위에 @Autowired 를 붙여줌

@Autowired

private CustomerRepository custRepository;

728x90