Case sensitivity issue in Spring application
I have been given a Java Spring application to containerize. I am using a Tomcat8/Java8 base image. When it boots, it fails to deploy with the following error:
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'controller3P' for bean class [com.******.******.brand3P.controller.Controller3P] conflicts with existing, non-compatible bean definition of same name and class [com.******.******.Brand3P.controller.Controller3P]
The problem here seems to that Spring is finding 2 conflicting classes, differentiated by “brand3P” and “Brand3P”.
However, in the source code, I can find no reference to a class “Brand3P”, only a class “brand3P”.
Can anyone explain what Spring is doing here?
(Be nice, I’m Ops, not Dev)
2 Solutions collect form web for “Case sensitivity issue in Spring application”
Package name should be all lower cased, checkout here oracle doc
Package name is not included in spring definition name.
My guess is someone changed the package name in Git, because git is by default case insensitive, so you will run into this situation, if it is this case, remove the file and create it again will fix this problem.
- Hi Ops, please work with Devs together 😉
Turns out it was an issue with the build in Jenkins. The code had changed (Brand3P -> brand3P) but the older class name was hanging around in the Jenkins workspace, and being bundled into the Docker image.
We deleted the workspace, re-ran the build, and all was fine.