@Autowired 대상 객체가 메모리에 없을 때
컨테이너는 NoSuchBeanDefinitionException 을 발생시킨다
해당 객체가 메모리에 생성되어 있어야 하므로 다음 두가지 방법으로 해결하면 된다
1. XML 설정
<bean id="id" class="클래스경로"></bean>
2. Annotation 설정
해당 클래스 파일로 들어가 Annotation을 추가해준다
@Component("id")
public class TestClass {
...
}
이 때, id값의 오타로 인해서 Execption이 발생될 수도 있으니 오타 주의!
'IT TIPS > Spring' 카테고리의 다른 글
[Spring] error at ::0 can't find referenced pointcut allPointcut 해결방법 (0) | 2017.08.12 |
---|---|
[Spring] pom.xml에서 Missing Artifact 해결방법 (1) | 2017.08.09 |
[Spring] bean 엘리먼트 속성 4가지 알아보기 (0) | 2017.08.01 |
[Spring] XML 설정 파일 만들기 (0) | 2017.08.01 |
[Spring] pom.xml에서 invalid loc header (bad signature) 해결방법 (0) | 2017.07.30 |