关于Spring的一错误,大家来讨论一下啊

nhl158518 2012-04-15 12:03:48
cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:conponent-scan'.

beans.xml文件为:
<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/context">
<context:conponent-scan base-package="spring14.com"></context:conponent-scan>

</beans>
怎样才能是xml文件有效呢?
...全文
97 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ncist_jianeng 2012-04-17
  • 打赏
  • 举报
回复
<context:conponent-scan base-package="spring14.com"></context:conponent-scan>
用注解时就要配置。。。其中base-package是要扫描的包

把这几句也加进去

xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
-AJ- 2012-04-17
  • 打赏
  • 举报
回复
<context:annotation-config />应该加上。
我怀疑楼主的spring包没加全。常用的:
spring-core
spring-context
spring-beans
spring-web
spring-tx
spring-webmvc
nhl158518 2012-04-16
  • 打赏
  • 举报
回复
不行的哦,会出现:cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation-config'
chenxiang_java 2012-04-15
  • 打赏
  • 举报
回复
<context:annotation-config />
是不是要加这个哦

50,526

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧