struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: RE [S2] autowiring with hand rolled factory
Date Mon, 13 Aug 2007 21:11:48 GMT
Um, to allow all the capabilities of Spring (dependency injection, AOP 
or whatever) to be applied to action instances?

L.

Adam Hardy wrote:
> Thanks for the explanation. What would you say the main rationale is 
> then for using Spring as a factory for the actions instead of the struts 
> objectfactory?
> 
> Regards
> Adam
> 
> MLENEVEUT@abusinessware.com on 13/08/07 08:13, wrote:
>> Did you set this in your struts.xml ?
>>
>> <constant name="struts.objectFactory" value="spring" />
>>
>> or
>>
>> <constant name="struts.objectFactory" value=
>> "org.myorg.mySpringContextFactory" />
>>
>> For Autowiring, it's enable by default. But you can customise it : 
>> http://struts.apache.org/2.0.9/docs/spring-plugin.html
>>
>> The framework enables "autowiring" by default. (Autowiring means to 
>> look for objects defined in Spring with the same name as your object 
>> property). To change the wiring mode, modify the spring.autowire 
>> property.
>> Wiring Mode
>> struts.objectFactory.spring.autoWire = type
>> The autowire property can be set to several options.
>> name Auto-wire by matching the name of the bean in Spring with the 
>> name of the property in your action. This is the default type 
>> Auto-wire by looking for a bean registered with Spring of the same 
>> type as the property in your action. This requires you to have only 
>> one bean of this type registered with Spring auto Spring will attempt 
>> to auto-detect the best method for auto-wiring your action constructor 
>> Spring will auto-wire the parameters of the bean's constructor
>> By default, the framework will at least try to use Spring to create 
>> all its objects. If the object cannot be created by Spring, then the 
>> framework will create the object itself.
>>
>>
>>
>>
>> Adam Hardy <ahardy.struts@cyberspaceroad.com> 12/08/2007 11:25
>> Veuillez répondre à
>> "Struts Users Mailing List" <user@struts.apache.org>
>>
>>
>> A
>> Struts Users Mailing List <user@struts.apache.org>
>> cc
>>
>> Objet
>> [S2] autowiring with hand rolled factory
>>
>>
>>
>>
>>
>>
>> I'm sure I saw some references to this in the documentation before but 
>> I can't find it again now that I need it.
>>
>> I have my own context factory for Spring which I want to plug into the 
>> struts framework, but I can't work out how to set up the autowiring 
>> interceptor .
>>
>> It seems I must replace ActionAutoWiringInterceptor and configure it 
>> as 'anotherAutowiring' or similar. Would that be correct?
>>
>> While I'm on the subject, I'm not planning on setting up my actions in 
>> Spring, so I assume that struts2 will use its own ObjectFactory to do 
>> this.
>> What is the reasoning behind the functionality that allows me to set 
>> up my
>> actions in Spring? Is it just the rich configuration possibilities that
>> Spring offers which struts wants to harness?



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


Mime
View raw message