'Two beans with the same name results in ConflictingBeanDefinitionException in different dependency

I am using 2 different dependencies, They have same class name in it. so when application started, it gives this error :

Unexpected exception parsing XML document from URL [jar:file:/.../spring/applicationContext.xml]; 
    nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: 
        
Annotation-specified bean name 'XXX' for bean class [a.b.XXX] conflicts with existing, non-compatible bean definition of same name and class [c.d.XXX]

I can't change their definition, they are in 2 different libraries that I don't have control. I can't change their configuration like @Component("ABC");

is there any other way around to solve this problem ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source