Inspectopedia
 
2024.3

Incorrect dependency injection place

Error
Reliability
New
Last modified: 03 December 2024

Reports incorrect injection points: fields, methods, and parameters annotated with @Inject that violate the CDI specification.

Requirements for fields:

  • Cannot be static or final

  • Cannot be annotated with @Produces

Requirements for methods with injection:

  • Cannot be static or abstract

  • Cannot have parameters with @Disposes and @Observes annotations