The converters are created by the internal IOC container, so the
Spring beans wont be injected. A "hack" I can think of is to add
something like this to the converter:

@Inject(StrutsConstants.STRUTS_OBJECTFACTORY)
public void setObjectFactory(ObjectFactory factory) {
   //save the factory for later
}

that factory will be the Spring object factory, which you can use to
lookup the beans that you need. Not much of "inversion of control" but
it should work.

musachy

On Fri, Feb 6, 2009 at 9:59 AM, Griffith, Michael *
<michael.griff...@fda.hhs.gov> wrote:
> How can you tell? This is handed by the plug-in, right? From my
> struts.properties file:
>
> struts.objectFactory = spring
> struts.objectFactory.spring.autoWire = name
> struts.objectFactory.spring.useClassCache = true
>
> -----Original Message-----
> From: Musachy Barroso [mailto:musa...@gmail.com]
> Sent: Friday, February 06, 2009 8:54 AM
> To: Struts Users Mailing List
> Subject: Re: TypeConverter needs Spring Bean
>
> Are the converters created by the object factory? if not, then it will
> not work.
>
> musachy
>
> On Fri, Feb 6, 2009 at 9:46 AM, Griffith, Michael *
> <michael.griff...@fda.hhs.gov> wrote:
>> I also tried adding the @Autowired annotation to the dependency, but
>> it did not work.  Can anyone clarify how this is supposed to work?
>> MG
>>
>> -----Original Message-----
>> From: Steven Yang [mailto:kenshin...@gmail.com]
>> Sent: Thursday, February 05, 2009 8:15 PM
>> To: Struts Users Mailing List
>> Subject: Re: TypeConverter needs Spring Bean
>>
>> Hi
>> I also need my Converter to be handled by Spring however I could not
>> get it to work as well.
>> From my observation is that the Converter is set to X-Work but not to
>> Struts, there for the Spring plugin may not work there.
>> Please correct me if I am wrong.
>> Or is there a correct way to set it up?
>>
>> Thanks
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to