summaryrefslogtreecommitdiff
path: root/spring-framework/22-aop-xml-around/src/main/resources/META-INF
diff options
context:
space:
mode:
Diffstat (limited to 'spring-framework/22-aop-xml-around/src/main/resources/META-INF')
-rw-r--r--spring-framework/22-aop-xml-around/src/main/resources/META-INF/spring/applicationContext.xml60
1 files changed, 60 insertions, 0 deletions
diff --git a/spring-framework/22-aop-xml-around/src/main/resources/META-INF/spring/applicationContext.xml b/spring-framework/22-aop-xml-around/src/main/resources/META-INF/spring/applicationContext.xml
new file mode 100644
index 0000000..b6126cf
--- /dev/null
+++ b/spring-framework/22-aop-xml-around/src/main/resources/META-INF/spring/applicationContext.xml
@@ -0,0 +1,60 @@
+<?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: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/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
+
+ <bean id="account" class="com.example.spring.aop.Account">
+ <property name="accNo" value="1000"></property>
+ <property name="balance" value="250.00"></property>
+ </bean>
+
+ <!-- Here is a bean representing the security aspect -->
+ <bean id="accessChecker"
+ class="com.example.spring.aop.security.AccessChecker2" />
+
+ <!-- This aspect can print the method signatures when methods are executed
+ - before, and after -->
+ <bean id="aopLogger"
+ class="com.example.spring.aop.aoplogger.Logger" />
+
+ <aop:config>
+ <!-- <aop:aspect id="securityAspect" ref="accessChecker"> -->
+
+ <!-- <aop:pointcut id="deposit" -->
+ <!-- expression="execution(public * com.example.spring.aop.Account.deposit(..))"
+ /> -->
+ <!-- <aop:before pointcut-ref="deposit" -->
+ <!-- method="checkDepositPermission" /> -->
+
+ <!-- <aop:pointcut id="withdraw" -->
+ <!-- expression="execution(public * com.example.spring.aop.Account.withdraw(..))"
+ /> -->
+ <!-- <aop:before pointcut-ref="withdraw" -->
+ <!-- method="checkWithdrawPermission" /> -->
+
+ <!-- </aop:aspect> -->
+
+ <!-- <aop:aspect id="loggerAspect" ref="aopLogger"> -->
+
+ <!-- <aop:pointcut id="bankPackageMethod" -->
+ <!-- expression="execution(public * com.example.spring.aop.**.*(..))" /> -->
+ <!-- <aop:before pointcut-ref="bankPackageMethod" -->
+ <!-- method="beforMethodExecuted" /> -->
+ <!-- <aop:after pointcut-ref="bankPackageMethod" -->
+ <!-- method="afterMethodExecuted" /> -->
+
+ <!-- </aop:aspect> -->
+
+ <aop:aspect id="loggerAspect" ref="aopLogger">
+ <aop:pointcut id="allMethods"
+ expression="execution(public * com.example.spring.aop.**.*(..))" />
+ <aop:around pointcut-ref="allMethods"
+ method="methodExecutionMonitor" />
+ </aop:aspect>
+ </aop:config>
+
+
+</beans> \ No newline at end of file