【问题标题】:The matching wildcard is strict, but no declaration can be found for element匹配的通配符是严格的,但是找不到元素的声明
【发布时间】:2012-08-26 22:16:09
【问题描述】:

我正在使用 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 定义解析期间意外失败:配置问题:Cannot locate BeanDefinitionParser for element [list]

    <beans:property name="interceptors">
        <list>

匹配的通配符是严格的,但找不到元素'list'的声明。

            <ref bean="authInterceptor" />
        </list>
    </beans:property>
    <beans:property name="mappings">
        <props>

匹配的通配符是严格的,但是找不到元素'props'的声明。

            <prop key="/home">HomeController</prop>
        </props>
    </beans:property>
</beans:bean>
<beans:bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">

bean 定义解析期间意外失败:配置问题:Cannot locate BeanDefinitionParser for element [props]

    <beans:property name="mappings">
        <props>

匹配的通配符是严格的,但是找不到元素'props'的声明。

            <prop key="/login">LoginController</prop>
        </props>
    </beans:property>
</beans:bean>
</beans:beans>

【问题讨论】:

    标签: java spring-mvc sts-springsourcetoolsuite


    【解决方案1】:

    &lt;list&gt;&lt;ref&gt; 标签属于 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>
      ...
    

    你也可以试试&lt;beans:util&gt;

    【讨论】:

      猜你喜欢
      • 2021-11-02
      • 2017-10-20
      • 2014-08-07
      • 1970-01-01
      • 1970-01-01
      • 2018-04-01
      • 2022-12-04
      • 2015-12-05
      • 2011-08-28
      相关资源
      最近更新 更多