0

Reference a spring bean from VariableResolver

asked 2021-01-20 05:21:08 +0800

RomanZK gravatar image RomanZK
1 1

updated 2021-01-26 09:57:28 +0800

cor3000 gravatar image cor3000
6280 2 7

How can I reference spring beans in a class that implements VariableResolver ?

From the zk essentials tutorials I tried using

Selectors.wireVariables(page, this, Selectors.newVariableResolvers(getClass(), null));

The above code cannot be applied in a class that implements VariableResolver interface.

Any ideas ?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2021-01-20 14:46:32 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2021-01-20 14:47:41 +0800

The question is not where ... but when.

ZK provides SpringUtil.getBean(name[, cls]) which is available during an active execution. You can use it from any class to get a spring bean by name, independent of which interface it implements.

https://www.zkoss.org/wiki/ZKSpringEssentials/WorkingwithZKSpring/WorkingwithZKSpringCore/UsingSpringVariableResolver#SpringUtil

link publish delete flag offensive edit

answered 2021-01-26 04:30:00 +0800

RomanZK gravatar image RomanZK
1 1

I have used the spring util class. It works.

Thanks

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
1 follower

RSS

Stats

Asked: 2021-01-20 05:21:08 +0800

Seen: 13 times

Last updated: Jan 26 '21

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