為什么所有通知都執(zhí)行了兩次,bean執(zhí)行了一次?
執(zhí)行兩次的結(jié)果像這樣
This?is?before! This?is?before! Biz?test?before. This?is?after! This?is?after!
由于接著之前的項目寫的,之前在xml配置文件中配置了掃描包的<context:component-scan base-package="com.imooc"></context:component-scan>
如果去掉掃描包的這句話,通知就會正常執(zhí)行一次
This?is?before! Biz?test?before. This?is?after!
通知和bean都是用xml的配置方式配置的,也沒用注解的形式配置? 為什么會這樣
2017-12-17
你的bean上面聲明了@component之類的注解、然后在xml又配置了一次,所以生成了兩個切面代理。