The container will inject the resource referred to by @Resource into the component either at runtime or when the component is initialized, depending on whether field/method injection or class injection is used.
What is the difference between runtime and "when the component is initialized" ?
The component is not initialized at runtime ??
I am sorry but i don't understand.
I understood that, during the deployment, "injected resource" is binding in the ENC of managed bean with the path declared by the attribute name => java:/comp/env/[name]
And that during execution, the resource is accessible (with injection or direct access) via the ENC entry.
But i don't understand the goal of the class level annotation (and so the goal of the <resource-ref>).
I you want use directly JNDI and if you do not declare class level annotation, you will have not entry in the ENC but you can lookup to the global JNDI, no ?
I am sure i missed something...
Thank you for your help
author & internet detective