[Spring] Context initialization failed org.springframework.beans.factory.BeanCreationException
[Spring] Context initialization failed org.springframework.beans.factory.BeanCreationException
Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name '*******': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ${A} ${B}; nested exception is org.springframework.beans.factory. NoSuchBeanDefinitionException: No qualifying bean of type [***] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
${A}: com.seunggabi.SimpleClass
${B}: com.seunggabi.tistory.SimpleClass
<bean id="SimpleClass" class="com.seunggabi.SimpleClass"/>
<bean id="TistorySimpleClass" class="com.seunggabi.SimpleClass"/>
패키지는 다르지만, 클래스 이름이 중복될 경우 autowired가 되지 않는 경우가 있습니다.
@Autowired
@Qualifier("TistorySimpleClass")
private SimpleClass simpleClass;
이렇게 선언하면 됩니다.