FP: Class is not reachable by @ComponentScan or @SpringBootApplication (java:S4605)

  • Operating system: Windows 10
  • SonarQube for IntelliJ plugin version: 11.7.0.83838
  • IntelliJ version: IntelliJ IDEA 2025.3
  • Programming language you’re coding in: Java
  • Is connected mode used: SonarQube Cloud

I’m not really sure if this is just a case of False positive for Spring java:S4605 for multi-module projects. “component is not visible by @ComponentScan” - SonarQube Server / Community Build - Sonar Community.

I’ve created a MRP here: Sax388/sonar-fp-componentscan-underscore.

Hello,

There is indeed an issue with this rule. However, it seems to be related to how SonarQube for IDE (Sonar Lint) analyses files. When you open a file, it only analyzes the opened file. As this rule requires multiple files to be analysed, the rule does not behave correctly.

On my side, the rule worked correctly when using the “Analyze All Project Files” feature in the SonarQube for IDE console in the IDE.

Does it work incorrectly when analyzing the whole project on your side?

I have created a ticket for this.

Lucien

1 Like

Yes, I can confirm that “Analyse All Project Files” doesn’t show the error. Thanks a lot for creating a ticket!

1 Like