2

I would like to do the following

public class AClass {
   @Inject 
   private AnotherBean anotherBean;

   @Inject
   private AGenericClass agenericClass = new GenericClass(BClass.class,anotherBean);
}

Basically inject a bean and pass it to another bean that is also instantiated via Injection. Additionally pass another (non injected) argument to aGenericClass. The AGenericClass bean also has several @Injected beans. I know this is not possible the way I wrote it but is there a way to do it at runtime? I must say I am very new at dependency-injection via the cdi (and di in general).

user2175783
  • 1,291
  • 1
  • 12
  • 28

0 Answers0