我需要在核心Http Servlet中执行spring事务。但似乎spring事务不起作用。我用@component注释了我的servlet,将它注册为spring bean。我还注释了以下方法,并且声明性交易需要必要的注释 从核心servlet的doGet(req,res)方法调用以下方法。
@Transactional(propagation=Propagation.REQUIRED, rollbackFor=Exception.class)
private String sendContractDetials(String tran) throws IOException {
customerDAO.remove(customer);
}
有些正文请告诉我如何在核心http servlet或其他一些工作中添加spring transaction支持。
答案 0 :(得分:0)
Spring的Transactional
注释并不神奇。为此,您需要在编译期间或运行时编写代码。
您是否在spring-context.xml配置文件中添加了<tx:annotation-driven/>
元素?