spring_由XML实现AOP面向切面编程_实现动态代理

来源:互联网 发布:门诊电子处方软件 编辑:程序博客网 时间:2024/06/06 03:13
<?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"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"><context:annotation-config /><!-- 自动扫描初始化对象 --><context:component-scan base-package="com.bjsxt" /><!-- 初始化该切面类 --><bean id="logInterceptor" class="com.bjsxt.aop.LogInterceptor"></bean><aop:config><!-- 全局切面逻辑范围 --><aop:pointcut expression="execution(public * com.bjsxt.dao..*.*(..))"id="daoPointcut" /><!-- 声明一个切面对象 --><aop:aspect id="logAspect" ref="logInterceptor"><!-- 在方法执行之前要执行哪个方法 --><aop:before method="brefore" pointcut-ref="daoPointcut" /></aop:aspect></aop:config></beans>

阅读全文
0 0