java - 匹配的通配符是严格的,但是找不到元素的声明

标签 java spring-mvc sts-springsourcetoolsuite

我正在使用 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 定义解析期间意外失败:配置问题:无法为元素 [list] 定位 BeanDefinitionParser

    <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 定义解析期间意外失败:配置问题:无法找到元素 [props] 的 BeanDefinitionParser

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

匹配的通配符很严格,但是找不到元素'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> .

关于java - 匹配的通配符是严格的,但是找不到元素的声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12226463/

相关文章:

java - 为什么 Maven 构建无法解析 Spring @Bean @Configuration 等注释?

java - 如何在spring boot中启用浏览器缓存

spring - 如何在没有 web.xml 的情况下以编程方式设置 session 超时、错误页面

java - Eclipse 中的 Spring 可视化 - UML 图等 - 开源

eclipse - 为什么我无法下载STS?

java - 何时使用 session.replicate() 方法

java - Cordova 无法为 2097152KB 对象堆保留足够的空间

java - 在 SVN 中重命名 Java 包是循环噩梦,出现“过时”和“不存在”错误

java - 在集合数据结构中按类类型或类名称对对象进行排序

java - 配置单元查询未执行。在CLI中显示异常