-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@Component not picked up by @ComponentScan if it has the same simple name as the main class #25952
Comments
This is an interesting issue. It appears that ClassPathBeanDefinitionScanner.checkCandidate returns Spring Boot does set I'm going to transfer this issue to the Spring Framework team to see if there's anything that can be done to improve the situation. |
Does using |
I'm sure that would work-around the issue, but it still feels strange that we don't get an exception when |
Understood. I'm tentatively slating this for 5.3.1 for further investigation. |
I suppose it's the |
Does it make sense to put additional if statement in to For this purpose it looks like that the code if (!this.registry.containsBeanDefinition(beanName)) {
return true;
} harms this usecase and by removing it we may get I think that in this case it should not fail on Or probably, |
Hello,
I have accidentally named my worker
@Component
class same as my main application class with@SpringBootApplication
and@ComponentScan
annotations. I have correct structure by documentation because my main class is in root package and other classes are in sub-packages.Seems like my
@Component
class is not being picked up by component scanning. It is in different package so I think this should work.Spring version = 2.3.4.RELEASE.
Build tool = Gradle 6.6.1
Thanks.
The text was updated successfully, but these errors were encountered: