0

ZK Generic forward composer autowires spring dependent beans !!!???

asked 2011-12-23 14:17:36 +0800

Lesstra gravatar image Lesstra
193 1

updated 2011-12-23 15:51:35 +0800

I would really like for someone to explain to me how is this possible, and what is going on in the background?
Here is the detailed explanation...
I have a service (deviceService) singleton bean, which wraps DAO singleton bean. Service bean is form package that is used for spring's transaction management. Here is the key part of my spring config (spring autowiring is turned off by default !!!):

<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
	<property name="sessionFactory" ref="sessionFactory" ></property>
	<property name="maxResults" value="3000" ></property>
</bean>

<bean id="baseDAO" abstract="true" class="org.irvas.amregina.backend.dao_implement.BaseDAO">
	<property name="hibernateTemplate" ref="hibernateTemplate" ></property>
</bean>

<bean id="deviceDAO" class="org.irvas.amregina.backend.dao_implement.DeviceDAOImplement" parent="baseDAO" ></bean>
<bean id="deviceService" class="org.irvas.amregina.backend.service_implement.DeviceServiceImplement" >
    <property name="deviceDAO" ref="deviceDAO" ></property>
</bean>

<tx:advice id="serviceTxAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="*" propagation="REQUIRED" ></tx:method>
    </tx:attributes>
</tx:advice>

<aop:config>
    <aop:pointcut id="serviceMethodsRMS"
        expression="execution(* org.irvas.amregina.backend.service.*.*(..))" ></aop:pointcut>
    <aop:advisor advice-ref="serviceTxAdvice" pointcut-ref="serviceMethodsRMS" ></aop:advisor>
</aop:config>

That is for the backend. Now, there is another config file for ZK controllers (GFC extends GenericForwardComposer):

<bean id="userWorkspace" class="de.forsthaus.UserWorkspace" scope="session" ></bean>
<bean id="basisCtrl" abstract="true" class="de.forsthaus.webui.util.GFCBaseCtrl" scope="prototype">
    <property name="userWorkspace" ref="userWorkspace" ></property>
</bean>
<bean id="deviceListCtrl" class="org.irvas.amregina.frontend.controllers.devicelist.DeviceListCtrl" parent="basisCtrl" scope="prototype">
    <!--
    <property name="deviceService" ref="deviceService"></property>
     -->
</bean>

OK. Now, when I call the ZUL page that is controlled by "deviceListCtrl", something calls the setter for the "deviceService", even though I explicitly turned off spring auto-wire, and I explicitly removed the service as a controller property in the config. Service bean is nevertheless injected.
Call stack from the debugger leads me to believe that ZK somehow does this, but I don't know the reason, and how to bypass it. What's up with the Components$Wire.injectByMethod()?
Here is the complete call stack of calling the service setter method:
 
DeviceListCtrl.setDeviceService(IDeviceService) line: 174	
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
Method.invoke(Object, Object...) line: 597	
Components$Wire.injectByMethod(Method, Class, Class, Object, String) line: 1156	
Components$Wire.wireOthers(Object) line: 1011	
Components$Wire.myWireVariables(Object) line: 975	
Components$Wire.wireVariables(Component) line: 971	
Components$Wire.access$500(Components$Wire, Component) line: 880	
Components.wireVariables(Component, Object, char, boolean, boolean) line: 525	
DeviceListCtrl(GenericAutowireComposer).doAfterCompose(Component) line: 275	
DeviceListCtrl(GenericForwardComposer).doAfterCompose(Component) line: 130	
UiEngineImpl.execCreateChild0(CreateInfo, Component, ComponentInfo, String) line: 740	
UiEngineImpl.execCreateChild(CreateInfo, Component, ComponentInfo, UiEngineImpl$ReplaceableText) line: 686	
UiEngineImpl.execCreate0(CreateInfo, NodeInfo, Component) line: 630	
UiEngineImpl.execCreateChild(CreateInfo, Component, ComponentInfo, UiEngineImpl$ReplaceableText) line: 662	
UiEngineImpl.execCreate0(CreateInfo, NodeInfo, Component) line: 630	
UiEngineImpl.execCreate(CreateInfo, NodeInfo, Component) line: 597	
UiEngineImpl.createComponents(Execution, PageDefinition, Page, Component, Map) line: 927	
ExecutionImpl(AbstractExecution).createComponents(String, Component, Map) line: 234	
Executions.createComponents(String, Component, Map) line: 178	
DefaultTreecell.createPage(Map) line: 121	
DefaultTreecell.onEvent(Event) line: 58	
EventProcessor.process0(Scope) line: 192	
EventProcessor.process() line: 138	
EventProcessingThreadImpl.process0() line: 517	
EventProcessingThreadImpl.run() line: 444

delete flag offensive retag edit

2 Replies

Sort by » oldest newest

answered 2012-01-17 00:43:16 +0800

samchuang gravatar image samchuang
4084 4

Hi

refer to here and here

link publish delete flag offensive edit

answered 2012-01-17 09:06:15 +0800

Lesstra gravatar image Lesstra
193 1

Thanks samchuang.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-12-23 14:17:36 +0800

Seen: 878 times

Last updated: Jan 17 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More