当前位置:编程学习 > JAVA >>

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

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文件有效呢? --------------------编程问答-------------------- <context:annotation-config />
是不是要加这个哦  --------------------编程问答-------------------- 不行的哦,会出现:cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'context:annotation-config' --------------------编程问答-------------------- <context:annotation-config />应该加上。
我怀疑楼主的spring包没加全。常用的:
spring-core
spring-context
spring-beans
spring-web
spring-tx
spring-webmvc --------------------编程问答-------------------- <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"
补充:Java ,  Java相关
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,