各位大牛,最近在学习spring 声明式事务配置,完成后总是无法回滚,于是看了spring transaction官方文档,并写了官方的例子,http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/transaction
发现仍然不能回滚,找不到原因,所以只能上论坛请教各位大神
下面是代码
包x.y.service
-- Boot.java
package x.y.service;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Boot {
public static void main(String[] args) {
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml", Boot.class);
FooService fooService = (FooService)ctx.getBean("fooService");
fooService.insertFoo(new Foo());
}
}
-- Foo.java
package x.y.service;
public class Foo {
private String fooName;
private String barName;
public Foo() {
super();
}
public Foo(String fooName, String barName) {
super();
this.fooName = fooName;
this.barName = barName;
}
public String getFooName() {
return fooName;
}
public void setFooName(String fooName) {
this.fooName = fooName;
}
public String getBarName() {
return barName;
}
public void setBarName(String barName) {
this.barName = barName;
}
}
-- FooService.java
package x.y.service;
public interface FooService {
public Foo getFoo(String fooName);
public Foo getFoo(String fooName, String barName);
public void insertFoo(Foo foo);
public void updateFoo(Foo foo);
}
-- DefaultFooService.java
package x.y.service;