Interface InjectionTarget<T>

Type Parameters:
T - The class of the instance
All Superinterfaces:
Producer<T>

public interface InjectionTarget<T> extends Producer<T>

Provides operations for performing dependency injection and lifecycle callbacks on an instance of a type.

Author:
Pete Muir, David Allen
See Also:
  • invalid reference
    javax.annotation.PostConstruct
  • invalid reference
    javax.annotation.PreDestroy
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    inject(T instance, CreationalContext<T> ctx)
    Performs dependency injection upon the given object.
    void
    postConstruct(T instance)
    Calls the
    invalid reference
    javax.annotation.PostConstruct
    callback, if it exists, according to the semantics required by the Java EE platform specification.
    void
    preDestroy(T instance)
    Calls the
    invalid reference
    javax.annotation.PreDestroy
    callback, if it exists, according to the semantics required by the Jakarta EE platform specification.

    Methods inherited from interface javax.enterprise.inject.spi.Producer

    dispose, getInjectionPoints, produce
  • Method Details

    • inject

      void inject(T instance, CreationalContext<T> ctx)

      Performs dependency injection upon the given object. Performs Jakarta EE component environment injection, sets the value of all injected fields, and calls all initializer methods.

      Parameters:
      instance - The instance upon which to perform injection
      ctx - The CreationalContext to use for creating new instances
    • postConstruct

      void postConstruct(T instance)

      Calls the

      invalid reference
      javax.annotation.PostConstruct
      callback, if it exists, according to the semantics required by the Java EE platform specification.

      Parameters:
      instance - The instance on which to invoke the
      invalid reference
      javax.annotation.PostConstruct
      method
    • preDestroy

      void preDestroy(T instance)

      Calls the

      invalid reference
      javax.annotation.PreDestroy
      callback, if it exists, according to the semantics required by the Jakarta EE platform specification.

      Parameters:
      instance - The instance on which to invoke the
      invalid reference
      javax.annotation.PreDestroy
      method