[에러내용]
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'securityConfig': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customUserDetailsService' defined in file [/Users/yoon/Code/WebBackend/reservation/target/reservation/WEB-INF/classes/kr/or/connect/security/service/CustomUserDetailsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl' defined in file [/Users/yoon/Code/WebBackend/reservation/target/reservation/WEB-INF/classes/kr/or/connect/security/service/UserServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'kr.or.connect.security.dao.UserDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
해석하자면,
1. securityConfig에 대한 bean을 만들때 에러가 발생했다.
2. nested exception을 보여줌으로써, 정확히 어느 부분이 에러가 났는지 쭉 파고들어간다
3. 마지막 부분 에러에, NoSuchBeanDefinitionException: No qualifying bean of type 'kr.or.connect.security.dao.UserDao' available: expected at least 1 bean which qualifies as autowire candidate.
라고 되어있는데, UserDao 타입의 빈이 없다고 말해준다. autowired를 위한 최소한 1개의 빈이 예상된다고 말해주고 있다.
즉, UserDao 빈이 없다는 것이다.
그래서, @Repository 어노테이션도 확인하고, config 파일도 확인했는데, 문제가 없었다.
문제는, 단순했다...
'kr.or.connect.security.dao' 가 컴포넌트 스캔 자체가 안된 것이다. componentscan 할 때 컴마를 빼먹은 것이 그 이유였다...
@ComponentScan(basePackages = {
"kr.or.connect.category.service," +
"kr.or.connect.comment.service," +
"kr.or.connect.displayinfo.service," +
"kr.or.connect.promotion.service," +
"kr.or.connect.security.service," +
"kr.or.connect.reservationinfo.service," +
"kr.or.connect.category.dao," +
"kr.or.connect.comment.dao," +
"kr.or.connect.displayinfo.dao," +
"kr.or.connect.promotion.dao," +
"kr.or.connect.security.dao" + // 이 부분 컴마를 빼먹어서 componentscan이 안됐다...
"kr.or.connect.reservationinfo.dao"
})
[참고 블로그]
https://sas-study.tistory.com/385
'Spring' 카테고리의 다른 글
[운영체제] 커널 스택이란 무엇인가? (0) | 2022.10.24 |
---|---|
[Spring] [ERROR] @RequiredArgsConstructor의 잘못된 사용으로 인한 NullPointerException (0) | 2022.10.10 |
[Spring] [쿠키,세션] RedirectAttributes (0) | 2022.10.03 |
[Spring] 쿠키, 세션 사용하기 (1) | 2022.10.03 |
[Spring] [Test] [Error] java.lang.NoSuchMethodError: 'org.springframework.util.ReflectionUtils$MethodFilter (0) | 2022.09.24 |