struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <>
Subject Re: How to get instance of the given dependency using Container
Date Mon, 01 Oct 2012 09:40:37 GMT
2012/9/30 Aum Strut <>:
> How can i pass this information to the container to get the instance
> of the class passed at run time?

First of all you shouldn't use Struts2 internal DI mechanism, use
Spring or Guice. But if you don't have any other option just declare
your bean in struts.xml and call with


<bean type="" />

or with interface


<bean type="" class="" />

or with two or more implementations

container.getInstance(MyInterface.class, "impl1")

<bean type="" class="" name="impl1" />
<bean type="" class="" name="impl2" />

And there are scopes as well.

+ 48 606 323 122

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message