[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-265) Inject via method parameters

Bruno E. Grossi (JIRA) jira-events at lists.jboss.org
Wed Mar 28 22:31:40 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-265?page=comments#action_12357721 ] 
            
Bruno E. Grossi commented on JBSEAM-265:
----------------------------------------

It can be interesting in constructors, or create methods (and other methods called by seam, and not by programmer), to access other components in that restricted scope avoiding the long time association and use of those other components.
Example:
@Name("important")
@Scope(ScopeType.CONVERSATION)
public class MyMostImportantComponent {
     @In(value="componentUsedOnlyToCreate", scope=ScopeType.EVENT)
     private ComponentTwo componentTwo;


     @Create
     public void init() {
         //unique location where ComponentTwo is used
     }

}


That code causes instanciation of ComponentTwo for every request/event of a conversation that use MyMostImportantComponent, but this is only necessary for the creation of this second.

With this new feature, we can use:
@Name("important")
@Scope(ScopeType.CONVERSATION)
public class MyMostImportantComponent {

     @Create
     public void init(@In(value="componentUsedOnlyToCreate", scope=ScopeType.EVENT) ComponentTwo componentTwo) {
         //use of componentTwo
     }

}


> Inject via method parameters
> ----------------------------
>
>                 Key: JBSEAM-265
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-265
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: Core
>            Reporter: Gavin King
>         Assigned To: Gavin King
>
> public void login(@In("user") User user) {
>    ...
> }
> is ugly, but we should support it anyway.

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

        



More information about the seam-issues mailing list