Skip to Content
0
Former Member
Feb 08, 2019 at 05:32 PM

org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter throwing NoUniqueBeanDefinitionException

257 Views

After adding ASM module in 5.6.0.12 we received an error on RequestMappingHandlerAdapterConfigurer.

 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 | ^[[morg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uk.co.testcom.demo.storefront.web.mvc.RequestMappingHandlerAdapterConfigurer#0': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter] is defined: expected single matching bean but found 2: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:308)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1202)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at de.hybris.platform.spring.HybrisContextLoaderListener.doInitWebApplicationContext(HybrisContextLoaderListener.java:145)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at de.hybris.platform.spring.HybrisContextLoaderListener.initWebApplicationContext(HybrisContextLoaderListener.java:125)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at de.hybris.platform.spring.HybrisContextLoaderListener.contextInitialized(HybrisContextLoaderListener.java:80)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5524)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at java.lang.Thread.run(Thread.java:745)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 | Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter] is defined: expected single matching bean but found 2: org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#0,org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter#1
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1061)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:457)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:435)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:559)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:169)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:305)
 INFO   | jvm 1    | main    | 2019/02/07 12:14:59.435 |         ... 25 more

 

We were able to overcome this by adding some custom code to the class, but unable to get the root cause of the issue. Has anyone seen this issue before?