One way to make proxies non spring dependant - i.e. not using the AopContext.currentProxy() method - is to provide a setter on the proxied class that gets called by the proxy creator.
Code:
class MyService {
MyService proxy;
public void setProxy(MyService proxy) {
this.proxy = proxy;
}
public void nonTrans() {
proxy.doTransA();
proxy.doTransB();
}
@Transactional
public void doTransA() {
...
}
@Transactional
public void doTransB() {
...
}
}