-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3611313
By: samokk
I am currently investigating the use of ZK + Spring (IoC container).
As far as I understand, it is not currently possible to have Spring directly inject dependencies to ZK classes.
For example, if I have a DAO managed by spring, and want to create a widget that lists all accounts, I have to get a reference (somehow, probably using some httpSession variable) to the DAO using the Spring API, and then do my stuff.
How does all the java code get translated to exactly ? In which kind of classes does it get incorporated to ?
Regards,
Sami Dalouche
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3611325
By: samokk
In the User Guide, I am reading that we can use our own class as a controller.
For ex:
public class MyWindow extends Window {
public void onCreate() { //does initialization
}
}
1) Since we extend a UI element, I don't personally see it as a true controller.
2) Anyways, I am wondering how hard it would be to integrate the code that instantiates MyWindow with Spring, so that we could have properties in MyWindow dependency injected..
Not exactly sure what everything looks like together, but just some random thoughts...
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3611636
By: tomyeh
A component is a plain Java object. You could create one by use of contructor directly. The challenge is when and how to add a component back to a desktop.
In ZK, it is done at any event listener. In Spring, it could be an issue.
I am not familar with Spring, so I cannot help much.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3612106
By: fernando_deleon
couldnt you just have setter and getters in your zk component class and in the application context xml inject whatever u want via its props entry?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3612134
By: samokk
Hi,
Well, in order to have beans managed by spring, you need the instances to be managed by Spring, (unless you use the latest Spring features using the crazy Anaemic features, which is literally impossible to understand for a human being).
So, since ZK instanciates itself the objects, it's kinda dead to have spring manage the dependencies.. the only thing I see would be to configure a set of services as spring beans, and just query the spring container to get the depency, but it's not Inversion Of Control anymore... ;-)
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3619728
By: nobody
Yeah...Looking at this too. I guess you would just have to fetch the applicationContext from the Application object when you want to invoke a Spring bean. It wouldn't be IOC I guess in terms of injecting into the ZK objects, but all the rest of your Spring beans would then be available so *most* of the IOC benefits from Spring would still be there. Haven't looked too deeply at ZK code but if every ZK object extends a certain base class, you could look up the ApplicationContext there so all ZK objects could use it.
Mike
Asked: 2006-03-05 08:56:51 +0800
Seen: 520 times
Last updated: Mar 09 '06