0

Spring-ZK @Autowire components not bound to bean/component scope

asked 2011-07-24 11:37:48 +0800

YberCyrus gravatar image YberCyrus
30

I assumed that in Spring-ZK @Autowired annotation autowires components within its bean scope. But seems it autowires the whole desktop components regardless of the bean scope which seems very illogical to me. In my case, I have window which is bound to controller of "idscope" bean scope. Scoping itself works fine, creates new bean when new window is created. I'm using them within tabs. The problem arises when I open multiple tabs of the same window, which happens to have components of the same ID as the @Autowire annotation depends on the component id to bind to correct component. Instead of binding to newly created component it binds to old tabs component which it finds first. Is there a way to use autowiring only for components inside the specified controller? If not then how to use reusable components? Especially in environment where multiple tabs could display same content from .zul file?

Here is how the beginning of the tab .zul looks like:
<window id="studentsWindow" width="100%" height="100%" apply="${studentsController}">
<grid id="studentsGrid" rowRenderer="@{studentsController.rowRenderer}" mold="paging" hflex="true" vflex="true">

studentsGrid autowired component on the seconds time gets bound to first tab grid not the second one.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2011-07-25 05:54:40 +0800

YberCyrus gravatar image YberCyrus
30

Problem solved. I removed all reusable components from .zul only left window component there which I applied controller and in controller I created child components manually and bound them to class variables, since "idspace" scope is working fine now the problem is solved.

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-07-24 11:37:48 +0800

Seen: 578 times

Last updated: Jul 25 '11

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