弹簧 MVC 元素 "ctx:annotation-config" 的前缀 "ctx" 未绑定


<?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>

我在 ctx:annotation-config行中收到错误,因为元素"ctx:annotation-config"的前缀"ctx"未绑定。我是初学者,请帮助我。

请在下面添加行

xmlns:ctx="http://www.springframework.org/schema/context"

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

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

最新更新