通知:輔助工做(故事)advice java
切點:故事發生的地點(pointcut) sql
advisor:通知者(把通知和切入點結合起來) session
代理:產生代理對象把目標和advisor結合 app
一、建立通知 代理
二、定義切入點和通知 對象
三、用proxyFactroyBean生成代理 get
<!-- 審計字段注入 -->
<bean id="sessionContextAwareAfterReturningAdvice"
class="*.SessionContextAwareAfterReturningAdvice">
<property name="awareStatement">
<value>begin nets_common_authority.p_set_current_um_id(?); end;</value>
</property>
</bean> it
<bean id="sessionContextAwareInteceptorAdvisor"
class="*.core.aop.support.NameMatchMethodPointcutAdvisor">
<property name="advice">
<ref local="sessionContextAwareAfterReturningAdvice" />
</property>
<property name="mappedName">
<value>getConnection</value>
</property>
</bean> io
<bean id="securityDS" class="*.core.aop.framework.ProxyFactoryBean">
<property name="interceptorNames">
<list>
<value>sessionContextAwareInteceptorAdvisor</value>
</list>
</property>
<property name="target">
<ref local="securityDataSource" />
</property>
<property name="proxyInterfaces">
<value>javax.sql.DataSource</value>
</property>
</bean> class