[cdi-dev] [JBoss JIRA] (CDI-718) Bean creation and dependency injection should not be performed before AfterDeploymentValidation

Martin Kouba (JIRA) issues at jboss.org
Wed Sep 27 05:40:00 EDT 2017


Martin Kouba created CDI-718:
--------------------------------

             Summary: Bean creation and dependency injection should not be performed before AfterDeploymentValidation
                 Key: CDI-718
                 URL: https://issues.jboss.org/browse/CDI-718
             Project: CDI Specification Issues
          Issue Type: Clarification
            Reporter: Martin Kouba
             Fix For: 2.1 (Discussion)


The spec is clear that it is not allowed to invoke {{BeanManager.getReference()}},  {{BeanManager.getInjectableReference()}} and {{BeanManager.createInstance()}} before {{AfterDeploymentValidation}}. I.e. it could be safely used during {{AfterDeploymentValidation}} and after the application initialization finished. The reason is that  before ADV the set of beans/interceptors/decorators may not be complete and extensions can still affect the resolution.

However, using {{InjectionTarget}}, {{UnmanagedInstance}} and {{Contextual.create()}} has the same risks. I think we should clarify the usage so that the spec is consistent.

WRT backward compatibility - note that the container is permitted to define a non-portable mode to overcome problems with legacy applications not using CDI SPI properly.




--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the cdi-dev mailing list