0

Apply DelegatingVariableResolver to all ViewModels

asked 2020-08-30 16:23:44 +0800

Arsen gravatar image Arsen
383 4

To use Spring managed service in my ViewModel in MVVM I need to add annotation

@VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class)

to each ViewModel class. Can I somehow register it as default resolver for all ViewModels?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-08-31 12:29:17 +0800

cor3000 gravatar image cor3000
5399 2 7
ZK Team

It is possible to configure a system-level variable resolver which will be used globally also for @WireVariable inside view models.

Add this to your zk.xml:

<listener>
    <listener-class>org.zkoss.zkplus.spring.DelegatingVariableResolver</listener-class>
</listener>

https://www.zkoss.org/wiki/ZK%20Configuration%20Reference/zk.xml/The%20listener%20Element/The%20org.zkoss.xel.VariableResolver%20interface

link publish delete flag offensive edit

Comments

thanks a lot

Arsen ( 2020-09-01 16:13:59 +0800 )edit
0

answered 2020-09-08 21:36:19 +0800

Jaksonjones gravatar image Jaksonjones
1

To wire the Spring-managed beans, you need to register the Spring variable resolver, DelegatingVariableResolver. Then, you could annotate @WireVariable for wiring a Spring-managed bean.

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: 2020-08-30 16:23:44 +0800

Seen: 14 times

Last updated: Sep 08

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