2 Replies Latest reply: Apr 21, 2012 2:34 AM by Aaron Anderson RSS

Access to InjectionPoint from custom CDI Context Scope?

Aaron Anderson Newbie

Given a Qualifer @FooId:


@Target({ ElementType.PARAMETER })                    
public @interface FooId {      
  String value(); 



and Custom Scope @FooScope:


public @interface FooScope {  } 



and Custom Object Foo:


 public class Foo {  }



and  injection target Bar:


public class Bar {                          
  Foo foo;                      




I would like to have access to the Injection Point foo in Bar so I can read the value of the @FooId annotation and return the appropriately scoped object. While this can be done with providers:



public Foo create(InjectionPoint ip, BeanManager mgr) {



there seems to be no way to do this in a custom scope:



public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) {         




where contextual is the annotated Bean type. Is this a limitation of CDI and if so will it be addressed in CDI 1.1?