Xml spring mvc前缀为;ctx“;对于“元素”;ctx:注释配置";不受约束

Xml spring mvc前缀为;ctx“;对于“元素”;ctx:注释配置";不受约束,xml,spring,Xml,Spring,由于元素“ctx:annotation-config”的前缀“ctx”未绑定,我在ctx:annotation-config行中出错。我是初学者,请帮助我解决此问题。正如我在您的XML配置中看到的,上下文是 xmlns:context=”http://www.springframework.org/schema/context" 所以您应该使用context:annotation-config。请在下面的行中添加 <?xml version="1.0" encoding="UTF-8"?&

由于元素“ctx:annotation-config”的前缀“ctx”未绑定,我在ctx:annotation-config行中出错。我是初学者,请帮助我解决此问题。

正如我在您的XML配置中看到的,上下文是 xmlns:context=”http://www.springframework.org/schema/context"

所以您应该使用context:annotation-config。

请在下面的行中添加

<?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:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans  
    http://www.springframework.org/schema/beans/spring-beans.xsd  
    http://www.springframework.org/schema/context  
    http://www.springframework.org/schema/context/spring-context.xsd  
    http://www.springframework.org/schema/mvc  
    http://www.springframework.org/schema/mvc/spring-mvc.xsd">

    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/jsp/"></property>
        <property name="suffix" value=".jsp"></property>
    </bean>
    <ctx:annotation-config></ctx:annotation-config>
    <ctx:component-scan base-package="com.wipro"></ctx:component-scan>

</beans>

用户
context:annotation-config
而不是
ctx:annotation-config
xmlns:ctx="http://www.springframework.org/schema/context"