Spring dependency injection framework does not support injecting data into static fields. When @Value, @Inject, or @Autowired are applied to static
fields, they are ignored.
What is the potential impact?
- Null Values: Uninitialized static fields annotated with @Value, @Inject, or @Autowired will not be initialized by Spring,
potentially causing NullPointerException at runtime.
- Confusing Code: The presence of injection annotations on static fields can mislead developers into believing that the fields
will be populated by Spring.
This rule raises an issue when a static field is annotated with @Value, @Inject, or @Autowired.