通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明

xiaoxiao2021-02-28  18

1.在Spring中注释配置bean,出现提示“”通配符的匹配很全面, 但无法找到元素 'context:component-scan' 的声明“”

应添加完整的 约束文件

<?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" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" 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 http://www.springframework.org/schema/aop  http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/tx

http://www.springframework.org/schema/tx/spring-tx.xsd">

2.在添加完约束文件后,仍然会报错,提示“”nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/“”,原因是缺少了2个Jar

(1)spring-aop-4.0.5.RELEASE.jar

(2)spring-aspects-4.0.5.RELEASE.jar

转载请注明原文地址: https://www.6miu.com/read-2650140.html

最新回复(0)