[webbeans-issues] [JBoss JIRA] Commented: (WBRI-380) Add prduction to InjectionServices to allow container to inject constructor dependencies

Pete Muir (JIRA) jira-events at lists.jboss.org
Thu Aug 27 08:32:23 EDT 2009


    [ https://jira.jboss.org/jira/browse/WBRI-380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12483015#action_12483015 ] 

Pete Muir commented on WBRI-380:
--------------------------------

One approach is to introduce a method like

public <T> T aroundProduce(ProductionContext<T> context);

on InjectionServices

interface ProductionContext<T> extends InjectionContext<T> {

   public List<Instance<?>> getParameterValues();

}

Which would at least allow the container to easily create the object. However we still have to disable/fix validation for constructors so that WB doesn't complain when non-bean parameters are present.

> Add prduction to InjectionServices to allow container to inject constructor dependencies
> ----------------------------------------------------------------------------------------
>
>                 Key: WBRI-380
>                 URL: https://jira.jboss.org/jira/browse/WBRI-380
>             Project: Web Beans
>          Issue Type: Feature Request
>          Components: Resolution (Typesafe and by Name)
>            Reporter: Kabir Khan
>             Fix For: 1.0.0.CR1
>
>
> The InjectionServices interface only allows injection into existing instances
> interface InjectionServices {
>   /**
>    * inject() will be called by Web Beans whenever it performs injection upon an
>    * InjectionTarget or Bean.
>    *
>    * In an EE environment, inject() must perform EE-style injection on the instance, as
>    * defined by annotations or deployment descriptors
>    */
>   void inject(Object instance);
> }
> Pete's example when explaining this to me is to make WB understand "foreign" annotations for injection, e.g.
> class MyBean
> {
>   @org.jboss.mc.Inject TxManager tm;
> }
> I think it would make sense to expand this to support constructor injection (simliar to Producer.produce()), so we can do
> class MyBean
> {
>     MyBean(@org.jboss.mc.Inject TxManager tm)
>     {
>     }
> } 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the weld-issues mailing list