を使用してテスト クラスの Bean を自動配線しようとしました@Autowire
が、Bean が配線されておらず、次の例外が発生します。
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No matching bean of type [com.abc.MyDaoHibernateImpl] 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)}
私のテストクラスは次のようになります。
package com.abc;
@ContextConfiguration(locations = { "classpath:applicationContext.xml" })
@TransactionConfiguration(transactionManager = "hibernateTransactionManager")
public class MyDaoHibernateImplTest
extends AbstractTransactionalJUnit4SpringContextTests
{
@Autowired
private MyDaoHibernateImpl myDao;
....
}
applicationContext.xml ファイルには、次の Bean 定義があります。
<bean id="myDao" class="com.abc.MyDaoHibernateImpl">
<property name="sessionFactory" ref="hibernateSessionFactory" />
</bean>
誰かが私が間違っているところを見ることができますか?
ご提案いただきありがとうございます。
--ジェームズ