私は春のプロジェクトに取り組んでおり、テストデータの一部を削除するためにjunitテストケースを書いていますが、次のエラーが発生しています..
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined
私のjunitテストは次のようになります:
public class TestRemoveTestData implements BeanFactoryAware {
static boolean functionReturn;
String user = "xxxx@aol.com.dev";
private BeanFactory beanFactory;
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}
@Autowired
private SessionFactory sessionFactory;
@Test
@Transactional(readOnly = true, propagation = Propagation.REQUIRED)
public void RemoveEnrollmentRecord()
{
Session mySession = sessionFactory.getCurrentSession();
//
// Get profile record based on email address
//
Profile myProfile = (Profile) mySession.createCriteria(Profile.class)
.add(Restrictions.like("email", user)).uniqueResult();
//
// Start to create a new Enrollment Record with a status of "U"
//
Enrollment newEnrollment = new Enrollment();
newEnrollment.setProfile_id(myProfile.getProfile_id());
newEnrollment.setContact_id(myProfile.getContact_id());
mySession.delete(newEnrollment);
mySession.flush();
}
}