『Spring Recipes』第三章ノート1:Enbaling AsppectJ Annotation

917 ワード

『Spring Recipes』第三章ノート:Enbaling AsppectJ Annotation
問題
どのようにSpring容器を開いてAsppectJに対する注釈をサポートしますか?
ソリューション
配置ファイルにaop schemaを導入し、配置を追加します.
<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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

  <aop:aspectj-autoproxy />
... ...
</beans>
CGLOIBを開く必要があるなら、「aop:aspectj-autoxy/」要素のproxy-target class属性をtrueに設定する必要があります.
Spring容器は、配置ファイルの中に配置があると発見されると、自動的にAspect Jの切断面に該当するbeanのためのプロキシを作成します.