Ticket #92 (closed defect: fixed)
Can't apply aop to beans created by factory
| Reported by: | d1rtym0nk3y | Owned by: | markmandel |
|---|---|---|---|
| Priority: | major | Milestone: | Alpha2 |
| Component: | AOP | Version: | 2.0 |
| Keywords: | aop proxy factory | Cc: |
Description
Not sure if this is a bug, or a limitation (of my understanding)
Given this config
<!-- transactions via aop -->
<aop:config>
<aop:advisor advice-ref="transactionAdvice" pointcut="@annotation(transaction)" />
</aop:config>
<bean id="transactionAdvice" class="coldspring.transaction.interceptor.TransactionInterceptor?" />
<bean id="EntityServiceFactory?" class="model.entity.service.ServiceFactory?" />
<!-- these beans are both instances of model.entity.service.UserService? -->
<bean id="UserServiceDirect?" class="model.entity.service.UserService?" />
<bean id="UserServiceViaFactory?" factory-bean="EntityServiceFactory?" factory-method="getUserService" />
method calls marked @transaction on UserServiceDirect? work as expected, but are not executed within a transaction in UserServiceViaFactory?.
Inspecting the services after they're injected i can see that UserServiceDirect? has been proxied but that UserServiceViaFactory? is an untouched instance of UserService?.