I just want to confirm that I fully understood the prerequisites for CDI to work. If I have a class A:
public class A {
@Inject private B b;
}
Does CDI only work if the class requiring an injection was also created by CDI container?
Yes, that's pretty much it. The lifecycle of a ManagedBean is controlled by the container and should never be instantiated with the new keyword (BTW: the same is true for EJBs & Spring beans). If you need to create a new ManagedBean you will probably want to use a producer method.