---- "Zheng schrieb:
> Yes, that's exactly how I inject spring beans. I am injecting a spring 
> managed bean to a JSF managed bean. What do you mean by defining all beans in 
> spring?  Do you suggest I should have spring manage my JSF bean? Is it 
> possible?

Yes. Spring version 2.0 and later support a "scope" attribute on bean 
definitions. Values include "request" and "session" as well as "singleton" and 
"prototype".

So now all beans can be declared in spring, and only navigation rules need to 
be in faces-config.xml. It is much nicer this way.

Spring can also support @PostConstruct annotations, and I think this is nicer 
than using Spring's old init-method property. After all, it is the *class* that 
knows whether it needs to be initialised or not.

There is still one thing the jsf managed-bean stuff can do that I don't know 
how to do in spring: injecting jsf "implicit" objects, like request parameter 
values.

And spring does *not* currently report errors when injecting a short-lifetime 
bean into one with a longer lifetime; jsf does warn about this which is a good 
idea.

But in all other ways, Spring is far superior.

Regards,
Simon

Reply via email to