Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-718

Bean creation and dependency injection should not be performed before AfterDeploymentValidation

XMLWordPrintable

    • Icon: Clarification Clarification
    • Resolution: Obsolete
    • Icon: Major Major
    • 2.1 (Discussion)
    • None
    • None
    • None

      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.

              Unassigned Unassigned
              mkouba@redhat.com Martin Kouba
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: