0

@WireVariable can be replaced by @Configurable without side effects?

asked 2013-11-07 17:20:27 +0800

pepek gravatar image pepek
1 1

updated 2013-11-07 20:22:57 +0800

Hi, can i really don't like zk's @WireVariable. So i used aop and replaced it:

added to Application Config:

<context:spring-configured/> 
    <context:load-time-weaver/>

Changed class:

//@VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class)
@Configurable
public class ZKSpringJPAExampleListVM {
    //@WireVariable
    @Autowired
    private ZkSpringJpaExampleService zkSpringJpaExampleService;
    private ZkSpringJpaExample selectedItem;

    public ZkSpringJpaExample getSelectedItem() {
        return selectedItem;
    }
    public void setSelectedItem(ZkSpringJpaExample selectedItem) {
        this.selectedItem = selectedItem;
    }
    @AfterCompose
    public void initSetup(@ContextParam(ContextType.VIEW) Component view) {
        Selectors.wireComponents(view, this, false);
    }

    public List<ZkSpringJpaExample> getexamplesListData() {
        List<ZkSpringJpaExample> result = zkSpringJpaExampleService.findAll();
        return new ListModelList<ZkSpringJpaExample>(result);
    }
}

Everything seems working fine. Is there any reason why don't use Spring annotations instead ZK's?

Thank you:)

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-11-26 05:59:37 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi

You can refer to the following link, we explain why we do not recommend use Spring bean: http://books.zkoss.org/wiki/ZKDeveloper'sReference/MVVM/Advanced/WireVariables#WireSpring-managed_Beans

link publish delete flag offensive edit
Your answer
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
1 follower

RSS

Stats

Asked: 2013-11-07 17:20:27 +0800

Seen: 15 times

Last updated: Nov 26 '13

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