我正在以Spring Boot为目标开发简单的Spring MVC应用程序。
我已添加到我的新jsp新mvcUrl
标记中:
<a href="${spring:mvcUrl('BMVCC#path').arg(0,'account').arg(1, '23').build()}">Account</a>
当请求此页面时,我得到下一个例外:
org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping] is defined: expected single matching bean but found 2: endpointHandlerMapping,requestMappingHandlerMapping
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:332)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:298)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968)
at org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder.getRequestMappingInfoHandlerMapping(MvcUriComponentsBuilder.java:340)
at org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder.fromMappingName(MvcUriComponentsBuilder.java:242)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)`
所以mvcUrl
标签尝试获取映射处理程序bean,但Spring Boot有两个bean:来自Spring MVC模块和Spring Boot Actuator模块。
有人有同样的问题吗?
答案 0 :(得分:2)
我刚刚发现同样的问题。对我而言,这听起来像春天webmvc中的一个错误。