关于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相关