struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: Interceptor IOC with Spring
Date Thu, 24 Sep 2009 15:51:12 GMT
The only other difference I can see between my (working) example and yours
is that I used the shortcut

<constant name="struts.objectFactory" value="spring" />

I don't know if there's a difference under the covers or not.

Also, is the intercept method of your interceptor being called?
  (*Chris*)

On Thu, Sep 24, 2009 at 8:45 AM, Mike Baranski <
list-subscriptions@secmgmt.com> wrote:

> <beans xmlns="http://www.springframework.org/schema/beans"
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>       xmlns:util="http://www.springframework.org/schema/util"
>       xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://www.springframework.org/schema/util
> http://www.springframework.org/schema/util/spring-util-2.0.xsd"
> default-autowire="byName">
>
> >-----Original Message-----
> >From: Chris Pratt [mailto:thechrispratt@gmail.com]
> >Sent: Thursday, September 24, 2009 11:29 AM
> >To: Struts Users Mailing List
> >Subject: Re: Interceptor IOC with Spring
> >
> >What do you have default-autowire set to in your applicationContext.xml?
> >  (*Chris*)
> >
> >On Thu, Sep 24, 2009 at 8:08 AM, Mike Baranski <
> >list-subscriptions@secmgmt.com> wrote:
> >
> >> OK, I'm stuck.
> >>
> >> applicationContext.xml (snipped):
> >> <bean id="sMCBaseAction"
> >class="com.secmgmt.struts2.base.SMCBaseAction">
> >> </bean>
> >>
> >> struts.xml (snipped):
> >> <constant name="struts.objectFactory"
> >> value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
> >>
> >> <interceptor-stack name="validationWorkflowStack">
> >>                                <interceptor-ref
> >name="redirectMessage"/>
> >>                                <interceptor-ref name="prepare"/>
> >>                                <interceptor-ref name="basicStack"/>
> >>                                <interceptor-ref name="validation"/>
> >>                                <interceptor-ref
> >name="operatorHistory"/>
> >>                                <interceptor-ref
> >name="passwordExpired"/>
> >>                                <interceptor-ref name="workflow"/>
> >> </interceptor-stack>
> >> <default-interceptor-ref name="validationWorkflowStack" />
> >>
> >> PasswordExpiredInterceptor method:
> >> public void setSMCBaseAction(SMCBaseAction b) throws Exception
> >>        {
> >>            this.action = b;
> >>            l.debug("Calling setSMCBaseAction with: " + b);
> >>            this.initMe();
> >>        }
> >>
> >> Actions (and my operatorHistory) interceptor have *other* beans
> >injected
> >> just fine.  Can someone point out where I'm going wrong (I'm sure it's
> >> something stupid).
> >>
> >> Thanks!
> >>
> >> >-----Original Message-----
> >> >From: Mike Baranski [mailto:list-subscriptions@secmgmt.com]
> >> >Sent: Wednesday, September 23, 2009 2:17 PM
> >> >To: 'Struts Users Mailing List'
> >> >Subject: RE: Interceptor IOC with Spring
> >> >
> >> >Doh!  Sorry for the goose chase, I'll review my code and post it if
> >I'm
> >> >still stuck...
> >> >
> >> >>-----Original Message-----
> >> >>From: Musachy Barroso [mailto:musachy@gmail.com]
> >> >>Sent: Wednesday, September 23, 2009 1:59 PM
> >> >>To: Struts Users Mailing List
> >> >>Subject: Re: Interceptor IOC with Spring
> >> >>
> >> >>Meh, it all works. Autorired with/without annotations and @Resource
> >> >>also works (in interceptors). @OP, something is wrong in your
> >> >>configuration, show us the code :)
> >> >>
> >> >>musachy
> >> >>
> >> >>On Wed, Sep 23, 2009 at 10:51 AM, Musachy Barroso
> ><musachy@gmail.com>
> >> >>wrote:
> >> >>> Chris, if autowiring works then using @Autowire with @Qualifier
> >> >>> (equivalent to @Resource) should also work, I have to try that.
> >> >>>
> >> >>> musachy
> >> >>>
> >> >>> On Wed, Sep 23, 2009 at 9:18 AM, Chris Pratt
> >> ><thechrispratt@gmail.com>
> >> >>wrote:
> >> >>>> In my struts.xml I have:
> >> >>>>
> >> >>>>  <constant name="struts.objectFactory" value="spring"/>
> >> >>>>
> >> >>>> And at the top of my applicationContext.xml I have:
> >> >>>>
> >> >>>> <beans default-autowire="autodetect" xmlns=...>
> >> >>>>
> >> >>>> And my Interceptors are getting injected just fine.  On another
> >> >>project, I
> >> >>>> have autowiring turned off, but then you have to define each
> >> >>interceptor as
> >> >>>> a bean in the applicationContext.xml and specifically define
the
> >> >>objects
> >> >>>> that get injected into it.
> >> >>>>  (*Chris*)
> >> >>>>
> >> >>>> On Wed, Sep 23, 2009 at 7:21 AM, Mike Baranski <
> >> >>>> list-subscriptions@secmgmt.com> wrote:
> >> >>>>
> >> >>>>> Correct me if I'm wrong, please, but if I have an interceptor,
> >it
> >> >>should
> >> >>>>> get
> >> >>>>> injected by spring.
> >> >>>>>
> >> >>>>> I have a bean I'm expecting, the set method written, and
the
> >bean
> >> >>defined
> >> >>>>> in
> >> >>>>> applicationContext.
> >> >>>>>
> >> >>>>> My main struts.xml has:
> >> >>>>>
> >> >>>>> <constant name="struts.objectFactory"
> >> >>>>> value="org.apache.struts2.spring.StrutsSpringObjectFactory"
/>
> >> >>>>>
> >> >>>>> My setter is not getting called, is there anything else
I need
> >to
> >> >>do?
> >> >>>>>
> >> >>>>>
> >> >>>>> M.
> >> >>>>>
> >> >>>>>
> >> >>>>> ----------------------------------------------------------------
> >---
> >> >-
> >> >>-
> >> >>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >>>>> For additional commands, e-mail: user-help@struts.apache.org
> >> >>>>>
> >> >>>>>
> >> >>>>
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> "Hey you! Would you help me to carry the stone?" Pink Floyd
> >> >>>
> >> >>
> >> >>
> >> >>
> >> >>--
> >> >>"Hey you! Would you help me to carry the stone?" Pink Floyd
> >> >>
> >> >>--------------------------------------------------------------------
> >-
> >> >>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >>For additional commands, e-mail: user-help@struts.apache.org
> >> >
> >> >
> >> >---------------------------------------------------------------------
> >> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> >For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> 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