struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umesh Awasthi <>
Subject Re: Best place to define properties for plugin
Date Wed, 05 Sep 2012 14:22:41 GMT
Thanks Gabriel  for the valuable inputs

On Wed, Sep 5, 2012 at 7:48 PM, Gabriel Belingueres

> 2012/9/4 Umesh Awasthi <>:
> > I am in process to create a plugin and i need to pass provider class as
> > well some other properties to the plugin bean class.
> > though i can define them in side the plugin's  xml file but want these
> > properties to be configurable.
> I know of several ways of doing this:
> 1) Defining the property as usual with its own setter/getter in the
> plugin class. This will let you configure it with the <param> tag when
> you define your interceptor stack. You should provide a sensitive
> default value in case no <param> tag is present.
> 2) Declaring a <bean> for injecting an instance of some class using
> the IoC container provided with Struts. In your plugin you need to
> annotate with @Inject the setter method that will be called to inject
> the instance.
> 3) Declare a <constant> that will specify the *name* of a bean to
> inject. This is what is annotated with @Inject.
> Also you need to inject an instance of the Container class.
> In the init() method of the plugin, just call:
> container.getInstance(MyClass.class, myInjectedString);
> to get the proper instantiation of a given type. This is most useful
> when you have different strategies of accomplish some functionality
> and you can choose one by declaring a constant.
> 4) Idem 3), but instead of declaring a global <constant> you use a
> property as in 1), then you can have different interceptor stacks with
> different values assigned to this particular functionality.
> > Since struts.xml loads after the plugin loading so i can not define the
> > properties there, any suggestion how to accomplish this ?
> The only constraint I know of is that a plugin must not depend on (nor
> interfere with) definitions done in other plugin.
> HTH,
> Gabriel
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

With Regards
Umesh Awasthi

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message