java属性“xmlns:?”必须为“bean”类型的元素声明
我试图使用<context:component-scan base-package="">
和<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”等等。我怎样才能解决这个问题?提前谢谢
# 1 楼答案
添加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">