java:S4605
I’m using SonarQube server 9.9 running SonarJava 7.16 and I’m getting the following issue on a Spring’s @Service annotated class:
‘MyClass’ is not reachable by
@ComponentScanor@SpringBootApplication. Either move it to a package configured in@ComponentScanor update your@ComponentScanconfiguration.
I believe it’s a false positive because the beans are actually accessible in the application context of the service accessing this class.
This is the @AutoConfiguration class:
package com.org.myapp.config;
@AutoConfiguration
@ComponentScan(
basePackageClasses = BaseScanningPackage.class,
excludeFilters = {
@ComponentScan.Filter(type = FilterType.ANNOTATION, classes = Configuration.class),
})
public class MyAppAutoConfig
{
}
And this is BaseScanningPackage:
package com.org.myapp;
public interface BaseScanningPackage
{
}