声明,使用 spring5.0.7,JDK8,idea2018.2
spring的xml配置aop中,报错如下:

原因: 导入命名空间或者schemaLocation中xsd约束出错;仔细检查发现缺少AOP的约束路径;

解决方案: 附上约束头:
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
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
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
</beans>
已解决;

本文解决在使用Spring 5.0.7与JDK8环境下,IDEA2018.2中配置AOP时遇到的XML报错问题。原因是缺少AOP的约束路径,通过添加正确的schemaLocation解决了问题。
1519

被折叠的 条评论
为什么被折叠?



