Spring 3.0错误:匹配的通配符很严格,但是找不到元素的声明
问题描述:
我对Spring框架还很陌生,所以如果这是一个简单的问题或一个菜鸟错误,请原谅我.我的问题是,当我尝试编译和部署项目时,出现错误:
I'm quite new to the Spring framework so forgive me if this is a simple question or a rookie mistake. My problem is that when I try to compile and deploy my project that I get an error:
The matching wildcard is strict, but no declaration can be found for element 'context:spring-configured'
我的调度程序xml文件包含以下内容:
My dispatcher xml file contains the following:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:spring-configured/>
<context:annotation-config/>
<context:component-scan base-package="connect.controller"/>
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
<!--
Most controllers will use the ControllerClassNameHandlerMapping above, but
for the index controller we are using ParameterizableViewController, so we must
define an explicit mapping for it.
-->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="index.htm">indexController</prop>
<prop key="main.htm">mainViewController</prop>
</props>
</property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />
<!--
The index controller.
-->
<bean name="indexController"
class="org.springframework.web.servlet.mvc.ParameterizableViewController"
p:viewName="index" />
我似乎无法弄清楚为什么它会引发未找到声明"错误.任何帮助或见识将不胜感激
I can't seem to figure out why it's throwing the No Declaration found error. Any help or insight would be greatly appreciated
答
我认为您的xsi:schemaLocation
声明丢失了http://www.springframework.org/schema/context
I think your xsi:schemaLocation
declaration is missing http://www.springframework.org/schema/context