java - 属性“xmlns:?” 必须为元素类型“beans”声明
问题描述
我正在尝试使用<context:component-scan base-package="">
and <context:annotation-config/>
。我的xml文件如下
<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"
xsi:schemaLocation="
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.3.xsd">
</beans>
但是eclipse一直抛出属性“xmlns”,并且必须为元素类型“beans”声明“xmlns:aop”、“xmlns:context”等。我怎样才能解决这个问题?提前致谢。
解决方案
添加spring beans xsd schemaLocation
<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"
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">
推荐阅读
- javascript - 在 Node.js 中读取文件
- apache-kafka - Flink Kafka 集成问题
- ios - Swift 中 AVAudioPlayer 的这个 URL 有什么问题?
- typescript - 根据 TypeScript 中的参数定义字典中函数的返回类型
- rust - 在 bin crate 中链接 rlib 文件
- excel - Excel:在范围内查找特定(文本)值
- postgresql - 如何根据 postgres 中的 lat long 和 duration 来检查用户是在旅行还是在某个未知位置等待
- html - puppeter-sharp 中第一页/最后一页/奇数页/偶数页上的不同页眉/页脚
- python - 将列标题更改为行中的值
- docker - Docker & gitlab-ci:在 Dockerfile 中构建应用程序,同时创建工件