1. 程式人生 > >Bean must be of 'org.aopalliance.aop.Advice' type

Bean must be of 'org.aopalliance.aop.Advice' type

在尚學堂的程式碼裡idea報了這樣的錯,看網上說都是aopliance.jar和aopliance-alpha.jar包起了衝突,可是我壓根都沒有找到這兩個包,我直接是用spring-web包封裝好的,找了半天最後終於找到了。

(下面的配置已經改正)

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

這是我applicatino-context.xml配置文件的首部其實是tx依賴寫錯了改為正確的就好了,改成xmlns:tx="http://www.springframework.org/schema/tx"