I have a class/spring bean A inside package a.b.c in a common artifact which is imported as a dependency in my project. There is the same class A defined in my project as well but in different packages lets say x.y.z. So when I run the spring boot app, it fails with the following exception. Is there any way to exclude the component A which is present in the common library, but I need other components present in the other library. I tried excluding using regex but still the same error.
"message": "Annotation-specified bean name 'A' for bean class [a.b.c.A] conflicts with existing, non-compatible bean definition of same name and class [x.y.z.A]",
"name": "org.springframework.context.annotation.ConflictingBeanDefinitionException",
"extendedStackTrace": [
{
"class": "org.springframework.context.annotation.ClassPathBeanDefinitionScanner",
"method": "checkCandidate",
"file": "ClassPathBeanDefinitionScanner.java",
"line": 345,
"exact": false,
"location": "spring-context-4.3.6.RELEASE.jar!/",
"version": "4.3.6.RELEASE"```