Looking at this code:
@Stateless
public class AStatelessEJB {
@Inject
private Logger logger;
(...)
Why a logger, which is typically final and static, is injected by CDI into a stateless EJB (as an instance variable)?
Is there any advantage? Or only disadvantages such as:
- overhead of CDI lookup (per each bean initialization)
- overhead of CDI initialization (per each bean initialization)
- overhead of CDI injection (per each bean initialization)
- overhead of garbage collector clean up (each time the bean gets destroyed)
Aucun commentaire:
Enregistrer un commentaire