3 Replies Latest reply on Jul 31, 2012 8:08 AM by Rafael Pestano

    Null InjectionPoint when injecting EJBs

    Rafael Pestano Novice

      Hi guys,


      i have a question about injecting EJBs, the following example works when using CDI beans:




      public interface MyInterface extends Serializable{
          String getValue();



      public class CDIBean  implements MyInterface,Serializable {
          private String value;
          public void init(InjectionPoint ip){
              if(ip != null){ //its null when CDIBean is an EJB
                  value = ip.getAnnotated().getAnnotation(MyAnnotation.class).param();
          public String getValue() {
              return value;
          public void setValue(String value) {
              this.value = value;


      I use the following annotation to pass parammeter to the CDI bean via InjectionPoint



      public @interface MyAnnotation {
          String param() default "";



      public class MyController implements Serializable{
          @Inject @MyAnnotation(value="a value")
          private MyInterface myInterface;
          public MyInterface getMyInterface() {
              return myInterface;
          public void setMyInterface(MyInterface myInterface) {
              this.myInterface = myInterface;


      when my bean is annotated with @Stateless CDI still can inject it but the injectionPoint is null



      @Stateless // ip will be null
      public class CDIBean  implements MyInterface,Serializable {


      So is this behavior expected?


      Im using Weld 1.1.4(shipped with Glassfish 3.1.2)


      Thanks in advance.