Hi all,
I am using @Transactional to proxy classes with transactional behavior. Therefore my spring context contains this:
However, in one case, the annotated class implements a certain interface, while I prefer to autowire that bean based on its class (the interface is meaningless in that particular context).Code:<tx:annotation-driven transaction-manager="myTransactionManager"/>
Like so:
This fails, as the created proxy is of type SomeInterface, and not MyService.Code:@Transactional class MyService implements SomeInterface {...} class Client { @autowired MyService service; }
In order for the autowiring to work, I need to change my AOP config, like so:
However, that would apply to all my beans, while I actually prefer to proxy by interface as a general rule.Code:<tx:annotation-driven transaction-manager="hibernateTransactionManager" proxy-target-class="true"/>
Is there a way to only apply the proxy-target-class to specific classes?
(Or - is there a different way to make the @autowire pick-up the proxy?)
Thanks,


Reply With Quote