Well, your story tells us you want to wrap the proxy factory bean itself.
The proxy factory bean creates proxies, as the name says so you should be fine with that. Maybe you could explain your situation a bit more.
Well, your story tells us you want to wrap the proxy factory bean itself.
The proxy factory bean creates proxies, as the name says so you should be fine with that. Maybe you could explain your situation a bit more.
So I will give you the code to explain that, this is code I have shown before:
applicationContext.xml
this is the code of app-servlet.xmlCode:<bean id="mixinbean" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"><ref local="testBean"/></property> <property name="interceptorNames"> <list> <value>mixinAdvisor</value> </list> </property> </bean> <bean id="wrapbean" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"><ref local="mixinbean"/></property> <property name="interceptorNames"> <list> <value>testInterceptor</value> </list> </property> </bean> <bean id="mixinAdvisor" class="test.advisor.MixinAdvisor" singleton="false"> </bean> <bean id="testBean" class="test.beans.TestBean"> </bean>
this is the test.advisor.MixinAdvisor class code:Code:<bean id="testController" class=test.controller.testController"> <property name="testbean"><ref bean="wrapbean"/></property> </bean>
so the testbean will implements testmixinImpl class after mixin.Code:public class MixinAdvisor extends DefaultIntroductionAdvisor{ public MixinAdvisor(){ super(new testmixinImpl(), testmixin.class); } }
this is the testInterceptor code:
I have some error will the code like above.Code:public Object invoke(MethodInvocation invocation) throws Throwable { ReflectiveMethodInvocation rinvocation = (ReflectiveMethodInvocation)invocation; if(rinvocation.getThis() instanceof testmixin) { //do some business code..... } }
I'd just add both advisors (the interceptor as well as the mixinAdvisor) to the same ProxyFactoryBean. You should be all set then!
i have the same situation. i am using the followling code
WebApplicationContext waContext = WebApplicationContextUtils.getRequiredWebApplicati onContext(servletContext);
return (BusinessServices) waContext.getBean("springBusinessService");
and this is my spring-config.xml file
<bean id="hibernateDataService" class="org.springframework.aop.framework.ProxyFact oryBean">
<property name="proxyInterfaces">
<value>DataServices</value>
</property>
<property name="interceptorNames">
<list>
<value>hibernateInterceptor</value>
//hibernate target code
<value>hibernateDataServiceTarget</value>
</list>
</property>
</bean>
<bean id="businessServiceImpl" class="BusinessService">
<property name="dataService">
<ref bean="hibernateDataService"/>
</property>
</bean>
<bean id="springBusinessService" class="org.springframework.transaction.interceptor .TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="springTransactionManager"/>
</property>
<property name="target">
<ref bean="businessServiceImpl"/>
</property>
<property name="transactionAttributes">
<props>
<prop key="echo">PROPAGATION_REQUIRED</prop>
<prop key="echoUnique">PROPAGATION_REQUIRES_NEW</prop>
<prop key="test">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
can i create the multiple ProxyFactoryBean so that i pass the differen bean to my businessServiceImpl bean.
i want to create multipal TransactionProxyFactoryBean that will be get when my application is using hibernate code, only require code will be there not all the code.
Regards
Ajay