struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Cook" <James.C...@wecomm.com>
Subject RE: Struts 2 Spring Plugin Usage
Date Mon, 02 Nov 2009 16:24:49 GMT
Hey Roger,

If I am understanding you then that is fine.

I often do the same, as I like to have a DAO as well as a Service layer.
So inject my DAO's into my Service and my Service into my actions.

Good ole' code by interface approach :)

-----Original Message-----
From: RogerV [mailto:roger.varley@googlemail.com] 
Sent: 02 November 2009 16:16
To: user@struts.apache.org
Subject: Struts 2 Spring Plugin Usage


In Mannings "Struts 2 in Action" there's an example of Spring
setter-injection by simply specifying the bean to be injected with a
basic
applicationContext.xml like;

<beans>
<bean id="securityManager" class="com.myApp.security.PasswordChecker" />
</beans>

and everywhere where my action classes have a setSecurityManager()
method
the PasswordChecker is injected. This works brilliantly. 

However how far down the "tree" can I go with this simple approach? For
example, the securityManager in turn has a setService(Service service)
method, and defining an additional <bean id="service" class="........"/>
is
not working as expected - the injection is not happening whereas 

<bean id="securityManager"
	class="com.myApp.security.PasswordChecker">
	<property name="service"><ref local="Service"/>
	</property>
</bean>

<bean id="Service" class="com.myApp.services.ServicesImpl"/> 

injects the SecurityManager with the service and then injects the
SecurityManager into my Action. Have I missed something or is this
working
as it should and I'm misunderstanding the book?

Regards
-- 
View this message in context:
http://old.nabble.com/Struts-2-Spring-Plugin-Usage-tp26157722p26157722.h
tml
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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
View raw message