Find Spring components no component scan reaches
ProprietaryMarks a class annotated @Component, @Service, @Repository, @Controller or @RestController whose package is not covered by any @ComponentScan or @SpringBootApplication in the repository's main sources, nor by a <context:component-scan> in its XML. SonarQube reports these because Spring never creates such a bean, so whatever injects it fails to start. Move the class under a scanned package or widen the scan. The scans of every module of the repository count for each of its components, and a repository with no component scan at all, such as a library whose components an application elsewhere scans, is not searched. Nothing is marked in a repository whose scans or registrations the recipe cannot fully resolve: a base package given by a constant, a property placeholder or an expression, a composed annotation that carries @ComponentScan, a ClassPathBeanDefinitionScanner call, a registration call given anything other than class literals, or a scan or a registration written in Kotlin or Groovy or in a Java or XML source that did not parse. A class is not marked either when it is named by a class literal in a Spring annotation such as @Import, passed to a call that registers it with a context, named by an XML <bean> definition, created by a @Bean method or a subtype of what one returns, or listed in spring.factories or an AutoConfiguration.imports file. Test sources are not searched, and @Configuration classes, abstract classes and interfaces are not marked.
io. moderne. java. spring. framework. FindComponentOutsideComponentScanmod run . --recipe= io. moderne. java. spring. framework. FindComponentOutsideComponentScanInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.