解决“通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明”问题

在学SpringMVC时,碰到了一些问题

出现通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明。这种问题

虽然写了

<context:component-scan base-package="com.controller"/>这个
但是beans中xmlns中的地址没有
写全,写全应该是这样:

 

 

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc
https://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd">
posted on 2021-09-02 22:10  kissshot9  阅读(348)  评论(0)    收藏  举报