I am trying to implement this tutorial about Declarative Transaction in Spring Framework application but don\'t work because when I try to execute the MainApp c
Option 1, change your configuration to inject transactions at the interface level:
and obtain the bean as an instance of that interface:
StudentDAO studentDao = (StudentDAO) context.getBean("studentJDBCTemplate");
Option 2, indicate that the proxy should extend the target class using proxy-target-class
attribute:
...
The first option is the cleaner one, but frankly I'd prefer to use@Transactional
annotations rather than AOP declarations within the Spring bean XML. It's sometimes diffucult to get the latter correct and if you don't have specific transactionality tests on your components, you will not necessarily notice that things are incorrect.