struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stanl...@gmail.com
Subject RE: implementaiton advise on custom TextProvider
Date Tue, 16 Oct 2012 19:39:51 GMT
Spring MVC might be a consideration! (wink)
On Oct 16, 2012 1:26 PM, "Davis, Chad" <Chad.Davis@emc.com> wrote:

> >
> > Okay.  I'm following this path.  I've got the Spring Plugin in place.
>  And it's
> > working.  I verified it by autowiring a trivial spring bean into one of
> my
> > actions.  But when I try to create my custom textprovider and then have
> it
> > used as the framework default text provider I'm getting some
> initialization
> > problems.  Here's what I'm doing:
> >
> > 1) spring config
> >
> >       <bean id="customTextProvider"
> > class="com.mycompany.textsupport.MyTextProviderSupport"/>
> >
> > 2) struts.xml
> >
> >           <bean type="com.opensymphony.xwork2.TextProvider"
> > name="myTextProvider" class="customTextProvider" scope="default" />
> >          <constant name="struts.xworkTextProvider"
> value="myTextProvider"/>
> >
> > But when I start the app I get the following error, thrown when the
> > framework tries to create the text provider bean.  It seems like the
> > framework isn't recognizing that I'm referencing a spring bean with the
> class
> > attribute . . .
> >
>
> So, I have figured this out.  The TextProvider is injected outside the
> control of the core objectfactory.  If you look at the ActionSupport class,
> you'll see that there is a lazy init method for acquiring the textprovider.
>  It uses the default ContainerImpl, as injected ( by type I think ) into
> the action, to inject the textprovider.  This means that it goes around the
> spring object factory for this injection.
>
> Not sure what to do.  Several workarounds come to mind.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message