匹配通配符是严格的,但是没有声明可以找到元素
问题描述:
我正在使用Springsource Tools Suite 3并尝试实现拦截。 这是代码和错误评价说:匹配通配符是严格的,但是没有声明可以找到元素
的servlet-context.xml的
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<annotation-driven />
<resources mapping="/resources/**" location="/resources/" />
<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
<beans:bean id="authInterceptor" class="com.bank.accounting.authentication.AuthInterceptor" />
<beans:bean id="authUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
bean定义解析过程中意外失败:配置问题:无法找到BeanDefinitionParser的元素[名单]
<beans:property name="interceptors">
<list>
匹配的通配符是严格的,但是对于元素'清单”。
<ref bean="authInterceptor" />
</list>
</beans:property>
<beans:property name="mappings">
<props>
匹配通配符是严格的,但没有声明可以为元件“道具”中找到。
<prop key="/home">HomeController</prop>
</props>
</beans:property>
</beans:bean>
<beans:bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
bean定义解析过程中意外失败:配置问题:无法找到BeanDefinitionParser的元素[道具]
<beans:property name="mappings">
<props>
匹配通配符是严格的,但没有声明可以为元素被发现'道具'。
<prop key="/login">LoginController</prop>
</props>
</beans:property>
</beans:bean>
</beans:beans>
答
<list>
和<ref>
标签属于util
namespace。第一添加:
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd"
然后适当地加前缀这些声明:
<util:list>
...
你也可以尝试用<beans:util>
。
+1。在我的情况下,我缺少schemaLocation声明。 –