You got it right, actually as I mentioned it was an old blog entry, it's been some time since I switched to the other way around (injecting using managed properties). It works and no problem:) I think I should update the entry as well for that part, but the idea will still be the same. The facade service is managed by faces, using the delegating variable resolver a spring bean is injected to the facade service.
Regards,
Cagatay Civici,
Cagatay Civici,
On 4/3/06, Philippe Lamote <[EMAIL PROTECTED]
> wrote:
Thanks Cagatay.
This is almost what I did, with one nuance though: I hadn't put up
the 'Facade' as JSF Managed Bean, but as a Spring Managed bean only.
(as it holds no values to feed any page, this was my first reaction
although what you did makes perfect sense, in fact I may do it that
way as well!)
What I wondered, looking at this, was: is it not possible, instead of
coding in every other JSF bean
"protected FacadeService facadeService;
public FacadeService getFacadeService() {
if (facadeService == null) {
facadeService = (FacadeService) getFacesContext().getApplication()
.createValueBinding("#{facadeService}").getValue(getFacesContext
());
}
return facadeService;
}
public void setFacadeService(FacadeService facadeService) {
this.facadeService = facadeService;
}"
... which is kinda heavy, to reference in the faces-config
declaration of any other JSF bean, a managed property of this Facade
bean?
So, if you do for every other JSF bean:
<managed-property>
<property-name> facadeService </property-name>
<property-class>yourpackagename.FacadeService</property-class>
<value>#{facadeService}</value>
</managed-property>
I feel it would allow, in your getFacadeService() method, to just do
this: if (facadeService == null) facadeService = new FacadeService()
Have you tried this? (and gotten a properly configured FS without
NPE? :-)
Philippe
On 03 Apr 2006, at 12:00, Cagatay Civici wrote:
Hi,
Philippe,
Maybe you should check out the following to see anything you are
missing; an old entry of mine,
http://www.jroller.com/page/cagataycivici?
entry=integrating_jsf_and_spring
Regards,
Cagatay Civici,
On 4/2/06, Martin Marinschek < [EMAIL PROTECTED] >
wrote:Well, as I said.
I've never done that before - injecting spring beans into JSF beans.
Catagay said he has it running, so maybe you should check back with
him...
As I said, I'd have concerns about the scope maybe preventing this
from working...
regards,
Martin
On 4/2/06, Philippe Lamote < [EMAIL PROTECTED] > wrote:
> Nice to see I'm not the only one working my XXX off in weekends ;-)
> Martin, I had actually already added all my JSF beans to my Spring
> xml file.
> Didn't really work, but apparently that wasn't what you meant.
> I removed it again, so the old errors came back... (= if I don't
> explicitely dig the necessary Sping beans up from the FacesContext in
> the JSF bean constructors)
>
> Philippe
>
> On 02 Apr 2006, at 21:05, Dennis Byrne wrote:
>
> Good, cause Sean just branched and I did not want to spend day and
> night looking for a better way ;)
>
> Dennis Byrne
>
> > -----Original Message-----
> > From: Martin Marinschek [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, April 2, 2006 03:02 PM
> > To: 'MyFaces Discussion'
> > Subject: Re: MyFaces - Spring integration problems
> >
> > No, no.
> >
> > I should be more clear today.
> >
> > What I meant is that the listener will be loaded automatically, and
> > that's good, cause it is absolutely necessary for MyFaces. But you
> > don't have to put it in the web.xml anymore, it will be loaded
> > automatically by the TLD.
> >
> > regards,
> >
> > Martin
> >
> >
> > On 4/2/06, Dennis Byrne <[EMAIL PROTECTED]> wrote:
> >>> You can leave out the StartupServletContextListener, and
nothing in
> >>> the whole app will change. This listener is in there for an issue
> >>> with
> >>> the WebLogic container, which has been fixed already.
> >>> Martin
> >>
> >> Martin,
> >>
> >> The deloyment descriptor is also parsed in the listener as well.
> >> Encryption is initialized there too. I have another completed
> >> feature for MyFaces that I am planning on committing today that
> >> uses the listener as well.
> >>
> >> Problems?
> >>
> >> Dennis Byrne
> >>
> >>
> >>
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
>
>
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces