Field accountRepository in org.hch.auth.service.UserServiceImpl required a bean of type 'org.hch.auth.repository.AccountRepository' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'org.hch.auth.repository.AccountRepository' in your configuration.
@Repository
public interface AccountRepository extends JpaRepository<Account, Long> {
}
@Service
public class UserServiceImpl implements UserService {
@Autowired
private AccountRepository accountRepository;
}
@AutoWired 관련 의존성 에러가 났다.
검색을 해보니 AccountRepository는 userServiceImpl의 의존객체이며 @Autowired를 붙여 생성자를 생성하려면 오류가 생긴다.
해결방법--> @Autowired에 required 속성값을 추가
@Autowired(required = false)은 의존성을 'Optional'로 설정
'SpringBoot' 카테고리의 다른 글
1) 스프링부트 초기세팅 (0) | 2021.08.03 |
---|---|
DeleteMapping "Request method 'POST' not supported" 오류 (0) | 2021.07.07 |
SpringBoot 2.5.0 For Jackson Kotlin classes support please add “com.fasterxml.jackson.module: jackson-module-kotlin” to the classpath 경고 (0) | 2021.06.02 |
LoggingFailureAnalysisReporter 에러 (0) | 2021.06.02 |