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).
This fails, as the created proxy is of type SomeInterface, and not MyService.
class MyService implements SomeInterface
@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.
<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?)