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.
This rule raises an issue when a static field is annotated with @Value, @Inject, or @Autowired.
Either use an instance field instead of a static field or remove the @Value, @Inject, or @Autowired annotation and initialize the field.
@Component
public class MyComponent {
@Value("${my.app.prop}")
private static SomeDependency dependency; // non compliant, @Value will be ignored and no value will be injected
// ...
}
@Component
public class MyComponent {
@Value("${my.app.prop}")
private final SomeDependency dependency;
// ...
}