S3749: FP when a class is annotated with @ConfigurationProperties (Spring-boot project)

Getting "Annotate this member with "@Autowired", "@Resource", "@Inject", or "@Value", or remove it." while running sonar for one of my spring-boot project.

  • Versions used :
    - Sonar Qube : 8.4.1
    - Java 8
    - spring-boot-dependencies.version : 2.2.5.RELEASE

  • Error observed : "Annotate this member with "@Autowired", "@Resource", "@Inject", or "@Value", or remove it.".

  • Steps to reproduce :

    • You can use this config class and can reproduce this issue.
      import lombok.Getter;
      import lombok.Setter;
      import a.b.c.d.ABCConfig;
      import org.springframework.boot.context.properties.ConfigurationProperties;
      import org.springframework.stereotype.Component;
      public class DefConfig {
      	private String url;
      	private ABCConfig abc = new ABCConfig();
      public class DefContext { }

It actually not recognizing the advantage/usage of @ConfigurationProperties .

Hello @rahulkk, welcome to the SonarSource community!

It seems that we already have a ticket for it: SONARJAVA-3535.

the advantage/usage of @ConfigurationProperties .

In addition, it would be really appreciated if you could you try to briefly explain why we should not raise an issue in this case or link to some documentation speaking about it?