I have application where the parent project is updated with the latest Spring library but in the dependent application I do not want to upgrade the spring beans lib version. Since the same dependent application we have to make it compatible with the older parents also which uses the older SF libraries. And also dont want to have multiple dependent application for older and newer parents
But now the problem is that I am getting class cast exception when using this dependent application with newer parent application.
"org.springframework.beans.factory.annotation.Autowire cannot be cast to org.springframework.beans.factory.annotation.Autowire"
Please help me if there is any workaround. Any help would be highly appreciated.
Parent application is using SF 4.1.4RELEASE(older) and 5.2.8RELEASE(upgraded)
Wed May 05 13:37:28 IST 2021 - java.lang.ClassCastException: org.springframework.beans.factory.annotation.Autowire cannot be cast to org.springframework.beans.factory.annotation.Autowire
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:223)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:148)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:124)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:318)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:95)