struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Roughley <...@fdar.com>
Subject Re: Help with the @Inject Annotation
Date Tue, 18 Sep 2007 16:35:44 GMT
I'm not sure that tag libraries are created by the object factory, if 
this is the case, then the behaviour you are observing is correct (as 
the annotations aren't checked and thus values not injected).  You 
should be able to track back the object creation in the code to confirm 
this.

/Ian

Chris Pratt wrote:
> I'm attempting to understand the @Inject Annotation and how it can be
> used.  I'm trying to create a tag library that needs to look up action
> data, so following the pattern from the FormTag I added this methods
> to my tag class:
>
>   private boolean enableDynamicMethodInvocation = true;
>   private Configuration configuration;
>   private ActionMapper actionMapper;
>
>   /**
>    * Inject a flag as to whether Dynamic Method Invocation is enabled
>    *
>    * @param enable "true" to enable
>    */
>   @Inject(StrutsConstants.STRUTS_ENABLE_DYNAMIC_METHOD_INVOCATION)
>   public void setEnableDynamicMethodInvocation (String enable) {
>     enableDynamicMethodInvocation = Boolean.parseBoolean(enable);
>     log.debug("Dynamic Method Invocation Enabled {}",enable);
>   } //setEnableDynamicMethodInvocation
>
>   /**
>    * Inject the Struts Configuration for looking up the proper Action
>    *
>    * @param config The Struts Configuration
>    */
>   @Inject
>   public void setConfiguration (Configuration configuration) {
>     this.configuration = configuration;
>     log.debug("Struts Configuration {}",configuration);
>   } //setConfiguration
>
>   /**
>    * Inject the Action Mapper
>    *
>    * @param actionMapper The Action Mapper
>    */
>   @Inject
>   public void setActionMapper (ActionMapper actionMapper) {
>     this.actionMapper = actionMapper;
>     log.debug("Struts Action Mapper {}",actionMapper);
>   } //setActionMapper
>
> But the attributes never get injected into the class.  Is there
> something else that I have to configure to get this working?  Thanks.
>   (*Chris*)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>   

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


Mime
View raw message