Thanks Musachy for your quick answer.

Tried setting default-autowire="byName" in the beans tag but the
behavior is the same, that is, the "templateDir" String bean is
injected after method execution AND byType:

2008-07-07 16:52:40,562 DEBUG
(org.springframework.beans.factory.support.DefaultListableBeanFactory:601)
- Autowiring by type from bean name
'org.apache.struts2.dispatcher.ServletDispatcherResult' via
constructor to bean named 'templatesDir'

Also I tested with an action that inject _other_ objects but NOT the
templateDir one, and the log is the same (even when I never defined
any setTemplateDir(String) method in the action!)

I'm seriously thinking in just put this templateDir String in my
web.xml context parameter list and move on...

2008/7/7, Musachy Barroso <[EMAIL PROTECTED]>:
> Did you try forcing Spring to autowrie by name? Add
> default-autowire="byName" to the "beans" tag in your spring config(s)
> file(s).
>
> musachy
>
> On Mon, Jul 7, 2008 at 4:09 PM, Gabriel Belingueres
> <[EMAIL PROTECTED]> wrote:
> > Debugging the Spring output I found the following:
> >
> > 2008-07-07 16:52:40,421 DEBUG
> > (org.springframework.beans.factory.support.DefaultListableBeanFactory:214)
> > - Returning cached instance of singleton bean 'allEventoService'
> > 2008-07-07 16:52:40,421 DEBUG
> > (org.springframework.beans.factory.support.DefaultListableBeanFactory:1033)
> > - Added autowiring by name from bean name 'admin.EditConstancia' via
> > property 'allEventoService' to bean named 'allEventoService'
> > 2008-07-07 16:52:40,421 DEBUG
> > (org.springframework.beans.factory.support.DefaultListableBeanFactory:214)
> > - Returning cached instance of singleton bean 'constanciaService'
> > 2008-07-07 16:52:40,421 DEBUG
> > (org.springframework.beans.factory.support.DefaultListableBeanFactory:1033)
> > - Added autowiring by name from bean name 'admin.EditConstancia' via
> > property 'constanciaService' to bean named 'constanciaService'
> > 2008-07-07 16:52:40,515 DEBUG (orm.SfapconstanciaManager:213) - EXECUTE
> > 2008-07-07 16:52:40,562 DEBUG
> > (org.springframework.beans.factory.support.DefaultListableBeanFactory:214)
> > - Returning cached instance of singleton bean 'templatesDir'
> > 2008-07-07 16:52:40,562 DEBUG
> > (org.springframework.beans.factory.support.DefaultListableBeanFactory:601)
> > - Autowiring by type from bean name
> > 'org.apache.struts2.dispatcher.ServletDispatcherResult' via
> > constructor to bean named 'templatesDir'
> >
> > I found several weird things:
> >
> > 1) templatesDir _is well defined_ in Spring since I did the following
> > in my app context listener and it worked OK:
> > WebApplicationContext context =
> > WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
> > System.out.println(context.getBean("templatesDir"));
> >
> > 2) In the above log trace, which corresponds to the execution of my
> > action, the other Spring dependencies are injected correctly (before
> > calling the action's execute() method)
> >
> > 3) The templateDir is NOT injected at this point (don't know why.)
> >
> > 4) AFTER my action's execute() method, templateDir _is_ injected into
> > a ServletDispatcherResult instance!!:
> > 2008-07-07 16:52:40,562 DEBUG
> > (org.springframework.beans.factory.support.DefaultListableBeanFactory:601)
> > - Autowiring by type from bean name
> > 'org.apache.struts2.dispatcher.ServletDispatcherResult' via
> > constructor to bean named 'templatesDir'
> >
> > (even it is injected by _TYPE_, which I never specified it before,
> > because AFAIK the Spring plugin uses byName as the default)
> >
> > I'm using Spring 2.5.5 and S2 2.1.2.
> >
> > 2008/7/7, Musachy Barroso <[EMAIL PROTECTED]>:
> >> The plugin doesn't really inject anything, it is all up to Spring.
> >>
> >> musachy
> >>
> >> On Mon, Jul 7, 2008 at 3:03 PM, Gabriel Belingueres
> >> <[EMAIL PROTECTED]> wrote:
> >> > Hi,
> >> >
> >> > I want to inject a String defined in the Spring's
> >> > applicationContext.xml file like this:
> >> >
> >> > <bean id="templatesDir" class="java.lang.String">
> >> >  <constructor-arg><value>/WEB-INF/templates/</value></constructor-arg>
> >> > </bean>
> >> >
> >> > but the Spring plugin does not try to inject it (It works with my
> >> > other injected, non String class objects though)
> >> >
> >> > It is OK that the plugin does not try to inject String objects?
> >> > (because they later can be overwritten with a parameter?)
> >> > or is this just a bug in the plugin?
> >> >
> >> > Regards,
> >> > Gabriel
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> > For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> "Hey you! Would you help me to carry the stone?" Pink Floyd
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to