【发布时间】:2010-06-24 16:02:57
【问题描述】:
我有一个基本的 Spring 控制器
package org.foo;
@Controller
public class HelloWorldController implements IHelloWorldController
{
@RequestMapping(value = "/b/c/", method = RequestMethod.GET)
public void doCriticalStuff(HttpServletRequest request, HttpServletResponse response){
//...
}
}
通过curl -X GET http://myIP:myPort/b/c/ 测试
效果很好。
如果我通过
配置事务管理<bean id="txManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="helloWorldPC"
expression="execution(* org.foo.IHelloWorldController.*(..)) && !execution(* java.lang.Object.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="helloWorldPC" />
</aop:config>
映射不再起作用。我在客户端收到 404 错误,在服务器上未输入方法。在doCriticalStuff 中使用断点进行 JUnit 测试我可以看到AopUtils.invokeJoinpointUsingReflection(Object, Method, Object[]) line: ...,因此使用了事务配置。
但是映射不再起作用。有任何想法吗?
我正在使用 Spring 3.0.2.RELEASE
【问题讨论】:
标签: java spring transactions spring-mvc