4 AspectJ框架
4.1AspectJ框架简介
一个基于java的aop框架
在Spring2.0后增加了对AspectJ框架的支持。在Spring框架中建议使用AspectJ框架开发AOP.
4.1.1AspectJ框架中的通知类型
前面四个与spring aop框架相同。
前置通知before
后置通知afterReturning
环绕通知around
异常通知afterThrowing
最终通知after :无论程序发生任何事情,都将执行
4.1.2Spring整合AspectJ框架所依赖的jar包
4.1.2.1AspectJ框架jar包
aspectjweaver-1.9.5.jar
4.1.2.2Spring框架jar包
beans
context
core
experssion
aop
aspects 这个是spring框架整合aspectj的jar包,spring框架本身不包含这个aspectj,整合第三方框架aspectj的jar包
commons-logging
4.1.3Aspect框架配置AOP的方式
两种:xml;注解
xml:
AspectJ配置(第三方框架自己的方式)
Spring的Schema_based方式
4.2AspectJ框架的使用
4.2.1AspectJ配置方式
意思是用AspectJ框架的配置方式来配置切面,在使用AspectJ配置切面时,切面不需要实现一些特定的接口。
4.2.1.1创建切面

package com.bjsxt.aop;import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;public class MyAspect {/*** 前置通知* @param joinPoint 对目标对象的封装*/public void myBefore(JoinPoint joinPoint) {//获取目标对象//joinPoint.getTarget();//获取目标对象目标方法名//joinPoint.getSignature().getName();//获取目标方法的参数列表//joinPoint.getArgs();//获取代理对象//joinPoint.getThis();System.out.println("Before..."+joinPoint.getSignature().getName());}/*** 后置通知* @param joinPoint 对目标对象的封装*/public void myAfterReturning(JoinPoint joinPoint) {System.out.println("After..."+joinPoint.getSignature().getName());}/*** 环绕通知* @param proceedingJoinPoint 继承JoinPoint 对他做增强,增加调用目标方法的语句* @return* @throws Throwable*/public Object myAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{System.out.println("Around Before..."+proceedingJoinPoint.getSignature().getName());//调用目标方法Object o =proceedingJoinPoint.proceed();System.out.println("Around After..."+proceedingJoinPoint.getSignature().getName());return o;}/*** 异常通知* @param e 目标方法执行抛异常后执行这个方法*/public void myAfterThrowing(Exception e){System.out.println("Exception "+e);}/*** 最终通知* 不要参数*/public void myAfter(){System.out.println("最终通知");}
}

4.2.1.2Execution表达式
是AspectJ框架的一种表达方式,用于配置切点(目标方法).
基本语法格式为:
execution(<修饰符模式>?<返回类型模式><方法名模式>(<参数模式>)<异常模式>?)
其中<修饰符模式>与<异常模式>为可选
execution(publiccom.bjsxt.service….*(…))
说明:



4.2.1.3使用AspectJ方式配置切面(xml)
4.2.1.3.1创建目标对象

package com.bjsxt.service;public interface UsersService {void addUsers(String username);
}
package com.bjsxt.service.impl;import com.bjsxt.service.UsersService;public class UsersServiceImpl implements UsersService {@Overridepublic void addUsers(String username){System.out.println("addUsers "+username);}}

2.1.3.2开启aop命名空间

<?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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd">

4.2.1.3.3配置切面

<?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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd"><!--配置目标对象--><bean id="userService" class="com.bjsxt.service.impl.UsersServiceImpl"></bean><!--配置切面对象--><bean id="myAspect" class="com.bjsxt.aop.MyAspect"></bean><!--配置切面--><aop:config><aop:aspect ref="myAspect"><!--配置切点--><aop:pointcut id="myPointcut" expression="execution(* com.bjsxt.service.*.*(..))"></aop:pointcut><!--前置通知--><aop:before method="myBefore" pointcut-ref="myPointcut"></aop:before><!--后置通知--><aop:after-returning method="myAfterReturning" pointcut-ref="myPointcut"></aop:after-returning><!--环绕通知--><aop:around method="myAround" pointcut-ref="myPointcut"></aop:around><!--异常通知--><aop:after-throwing method="myAfterThrowing" pointcut-ref="myPointcut" throwing="e"></aop:after-throwing><!--最终通知--><aop:after method="myAfter" pointcut-ref="myPointcut"></aop:after></aop:aspect></aop:config>
</beans>

4.2.1.3.4创建测试类

package com.bjsxt.test;import com.bjsxt.service.UsersService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Test {public static void main(String[] args) {//启动spring框架ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContextAspectj.xml");//从springioc中拿bean对象UsersService usersService = (UsersService) applicationContext.getBean("userService");//调用usersService.addUsers("oldLu");}
}

结果

4.2.1.4多切面以及切面执行顺序的配置
4.2.1.4.1创建第二个切面

package com.bjsxt.aop;import org.aspectj.lang.JoinPoint;public class MyAspect2 {public void myAspectBefore(JoinPoint joinPoint) {System.out.println("MyAspect2 Before "+joinPoint.getSignature().getName());}
}

4.2.1.4.2配置多切面

<?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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd"><!--配置目标对象--><bean id="userServicea" class="com.bjsxt.service.impl.UsersServiceImpl"></bean><!--配置切面对象--><bean id="myAspect" class="com.bjsxt.aop.MyAspect"></bean><bean id="myAspect2" class="com.bjsxt.aop.MyAspect2"></bean><!--配置所有的切面--><aop:config><aop:aspect id="my1" ref="myAspect" order="1"><!--配置切点--><aop:pointcut id="myPointcut" expression="execution(* com.bjsxt.service.*.*(..))"></aop:pointcut><!--前置通知--><aop:before method="myBefore" pointcut-ref="myPointcut"></aop:before><!--后置通知--><aop:after-returning method="myAfterReturning" pointcut-ref="myPointcut"></aop:after-returning><!--环绕通知--><aop:around method="myAround" pointcut-ref="myPointcut"></aop:around><!--异常通知--><aop:after-throwing method="myAfterThrowing" pointcut-ref="myPointcut" throwing="e"></aop:after-throwing><!--最终通知--><aop:after method="myAfter" pointcut-ref="myPointcut"></aop:after></aop:aspect><!--配置切面--><aop:aspect id="my2" ref="myAspect2" order="2"><aop:pointcut id="myPointcut2" expression="execution(* com.bjsxt.service.*.*(..))"></aop:pointcut><!--前置通知--><aop:before method="myAspectBefore" pointcut-ref="myPointcut"></aop:before></aop:aspect></aop:config>
</beans>

运行结果
配置order,多个切面按照order配置的顺序进行多目标方法的增强
MyAspect order=1
MyAspect2 order=2所以先执行MyAspect切面

改变xml中的order如下

<!--配置所有的切面-->
<aop:config><aop:aspect id="my1" ref="myAspect" order="2"><!--配置切点--><aop:pointcut id="myPointcut" expression="execution(* com.bjsxt.service.*.*(..))"></aop:pointcut><!--前置通知--><aop:before method="myBefore" pointcut-ref="myPointcut"></aop:before><!--后置通知--><aop:after-returning method="myAfterReturning" pointcut-ref="myPointcut"></aop:after-returning><!--环绕通知--><aop:around method="myAround" pointcut-ref="myPointcut"></aop:around><!--异常通知--><aop:after-throwing method="myAfterThrowing" pointcut-ref="myPointcut" throwing="e"></aop:after-throwing><!--最终通知--><aop:after method="myAfter" pointcut-ref="myPointcut"></aop:after></aop:aspect><!--配置切面--><aop:aspect id="my2" ref="myAspect2" order="1"><aop:pointcut id="myPointcut2" expression="execution(* com.bjsxt.service.*.*(..))"></aop:pointcut><!--前置通知--><aop:before method="myAspectBefore" pointcut-ref="myPointcut"></aop:before></aop:aspect>
</aop:config>

运行结果
MyAspect order=2
MyAspect2 order=1所以先执行MyAspect2切面中方法

4.2.2Schema_based配置方式
指的是使用spring aop模块定义切面并在aspectj框架中对该切面进行配置。要求切面在定义通知类型时,实现特定接口。
4.2.2.1创建切面

package com.bjsxt.schema_based;import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.aop.AfterReturningAdvice;
import org.springframework.aop.MethodBeforeAdvice;
import org.springframework.aop.ThrowsAdvice;import java.lang.reflect.Method;public class BasedMyAspect implements MethodBeforeAdvice, AfterReturningAdvice,MethodInterceptor, ThrowsAdvice {/*** 环绕通知* @param methodInvocation* @return* @throws Throwable*/@Overridepublic Object invoke(MethodInvocation methodInvocation) throws Throwable {System.out.println("Around Before...");Object o = methodInvocation.proceed();System.out.println("Around After...");return o;}/*** 后置通知* @param o* @param method* @param objects* @param o1* @throws Throwable*/@Overridepublic void afterReturning(Object o, Method method, Object[] objects, Object o1) throws Throwable {System.out.println("After.");}/*** 前置通知* @param method* @param objects* @param o* @throws Throwable*/@Overridepublic void before(Method method, Object[] objects, Object o) throws Throwable {System.out.println("Before.");}/*** 异常通知* @param e 目标方法抛出的异常对象*/public void afterThrowing(Exception e) {System.out.println("Exception "+e);}
}

4.2.2.2使用Schema_based配置方式配置切面
切面实现接口,xml中就不用配置标签关联方法和通知类型
4.2.2.2.1创建目标对象

package com.bjsxt.schema_based.service;public interface BasedUsersService {void addUsers(String username);
}
package com.bjsxt.schema_based.service.impl;import com.bjsxt.schema_based.service.BasedUsersService;public class BasedUsersServiceImpl implements BasedUsersService {@Overridepublic void addUsers(String username) {System.out.println("Add users.");}
}

4.2.2.2.2开启aop命名空间

<?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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd">
</beans>

4.2.2.2.3配置切面

<?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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd"><!--配置目标对象--><bean id="basedUsersService" class="com.bjsxt.schema_based.service.impl.BasedUsersServiceImpl"></bean><!--配置切面对象--><bean id="baseMyAspect" class="com.bjsxt.schema_based.aop.BasedMyAspect"></bean><!--配置切面,不需要关联通知类型,因为切面类已经实现通知接口类型--><aop:config><aop:pointcut id="basedPointcut" expression="execution(* com.bjsxt.schema_based.service.*.*(..))"></aop:pointcut><aop:advisor advice-ref="baseMyAspect" pointcut-ref="basedPointcut"></aop:advisor></aop:config>
</beans>

4.2.2.2.4创建测试类

package com.bjsxt.schema_based.test;import com.bjsxt.schema_based.service.BasedUsersService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class BasedTest {public static void main(String[] args) {ApplicationContext applicationContext2 = new ClassPathXmlApplicationContext("applicationContextBased.xml");BasedUsersService basedUsersService = (BasedUsersService)applicationContext2.getBean("basedUsersService");basedUsersService.addUsers("oldLu");}}

结果

4.2.2.3多切面以及切面执行顺序的配置
在schema_based配置方式中,可以添加多个aop:advisor标签实现多切面配置。在标签中包含order属性,配置切面执行顺序。
4.2.2.3.1创建切面

package com.bjsxt.schema_based.aop;import org.springframework.aop.MethodBeforeAdvice;import java.lang.reflect.Method;public class BasedMyAspect2 implements MethodBeforeAdvice{/*** 前置通知* @param method* @param objects* @param o* @throws Throwable*/@Overridepublic void before(Method method, Object[] objects, Object o) throws Throwable {System.out.println("BasedMyAspect2 Before.");}}

4.2.2.3.2配置多切面

<?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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd"><!--配置目标对象--><bean id="basedUsersService" class="com.bjsxt.schema_based.service.impl.BasedUsersServiceImpl"></bean><!--配置切面对象--><bean id="baseMyAspect" class="com.bjsxt.schema_based.aop.BasedMyAspect"></bean><bean id="baseMyAspect2" class="com.bjsxt.schema_based.aop.BasedMyAspect2"></bean><!--配置切面,不需要关联通知类型,因为切面类已经实现通知接口类型--><aop:config><aop:pointcut id="basedPointcut" expression="execution(* com.bjsxt.schema_based.service.*.*(..))"></aop:pointcut><aop:advisor advice-ref="baseMyAspect" pointcut-ref="basedPointcut" order="1"></aop:advisor><aop:advisor advice-ref="baseMyAspect2" pointcut-ref="basedPointcut" order="2"></aop:advisor></aop:config>
</beans>

结果

4.2.3注解配置方式
AspecJ框架允许使用注解定义切面、切入点和增强处理,Spring框架可以识别,根据这些注解生成aop代理
4.2.3.1常用注解
前几个都是aspectj框架提供的,后一个时是spring框架提供的
4.2.3.2创建切面

package com.bjsxt.aop;import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;@Aspect //指定当前对象为切面对象 被aspecj识别
public class MyAspect {/*** 配置切点*/@Pointcut("execution(* com.bjsxt.service.*.*(..))")public void myPointcut(){}/*** 前置通知* @param joinPoint*///@Before("execution(* com.bjsxt.service.*.*(..))")@Before("myPointcut()")public void myBefore(JoinPoint joinPoint){System.out.println("Before..."+joinPoint.getSignature().getName());}/*** hou置通知* @param joinPoint*///@AfterReturning("execution(* com.bjsxt.service.*.*(..))")@AfterReturning("myPointcut()")public void myAfterReturning(JoinPoint joinPoint){System.out.println("AfterReturning..."+joinPoint.getSignature().getName());}/*** 环绕通知* @param proceedingJoinPoint* @throws Throwable*///@Around("execution(* com.bjsxt.service.*.*(..))")@Around("myPointcut()")public void myAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{System.out.println("Around Before ");Object o = proceedingJoinPoint.proceed();System.out.println("Around After ");}/*** 最终通知*///@After("execution(* com.bjsxt.service.*.*(..))")@After("myPointcut()")public void myAfter(){System.out.println("最终通知");}/*** <!--异常通知 e指明哪个参数接目标对象抛出的异常对象-->*  <aop:after-throwing method="myAfterThrowing"*  pointcut-ref="myPointcut"*  throwing="e">*  </aop:after-throwing>** @param e*///@AfterThrowing(value = "execution(* com.bjsxt.service.*.*(..))",throwing = "e")@AfterThrowing(value = "myPointcut()",throwing = "e")public void myAfterThrowing(Exception e) {System.out.println("Exception "+e);}
}

4.2.3.3配置注解切面
4.2.3.3.1创建目标对象

package com.bjsxt.service;public interface UsersService {void addUsers(String username);
}
package com.bjsxt.service.impl;import com.bjsxt.service.UsersService;public class UsersServiceImpl implements UsersService {@Overridepublic void addUsers(String username) {System.out.println("add users");}
}

4.2.3.3.2开启aop命名空间
xmlns:aop=“http://www.springframework.org/schema/aop”
xsi:schemaLocation=" http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
``

<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/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd">

4.2.3.3.3配置切面

<?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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd"><bean id="usersService" class="com.bjsxt.service.impl.UsersServiceImpl"></bean><bean id="myAspect" class="com.bjsxt.aop.MyAspect"></bean><!--在AspectJ框架中开启注解处理声名自动为ioc容器中的那些配置了@AaspectJ的切面的bean对象创建代理,织入:目标对象放进代理工厂生成代理对象的过程--><!--默认false 使用jdkproxy创建代理对象 true 使用cjlib创建代理对象--><!--目标对象实现接口 jdkproxy 没有实现 cglib--><aop:aspectj-autoproxy proxy-target-class="false"></aop:aspectj-autoproxy>
</beans>

4.2.3.3.4创建测试类

package com.bjsxt.test;import com.bjsxt.service.UsersService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Test {public static void main(String[] args) {ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");UsersService usersService = (UsersService)applicationContext.getBean("usersService");usersService.addUsers("oldLu");}
}

结果
出现增强的方法

4.2.3.4配置多切面
4.2.3.4.1创建切面

package com.bjsxt.aop;import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.core.annotation.Order;@Aspect //指定当前对象为切面对象 被aspecj识别
@Order(1)
public class MyAspect2 {/*** 配置切点*/@Pointcut("execution(* com.bjsxt.service.*.*(..))")public void myPointcut(){}/*** 前置通知* @param joinPoint*///@Before("execution(* com.bjsxt.service.*.*(..))")@Before("myPointcut()")public void myBefore(JoinPoint joinPoint){System.out.println("Before2..."+joinPoint.getSignature().getName());}/*** hou置通知* @param joinPoint*///@AfterReturning("execution(* com.bjsxt.service.*.*(..))")@AfterReturning("myPointcut()")public void myAfterReturning(JoinPoint joinPoint){System.out.println("AfterReturning2..."+joinPoint.getSignature().getName());}/*** 环绕通知* @param proceedingJoinPoint* @throws Throwable*///@Around("execution(* com.bjsxt.service.*.*(..))")@Around("myPointcut()")public void myAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable{System.out.println("Around Before 2");Object o = proceedingJoinPoint.proceed();System.out.println("Around After 2");}/*** 最终通知*///@After("execution(* com.bjsxt.service.*.*(..))")@After("myPointcut()")public void myAfter(){System.out.println("最终通知2");}/*** <!--异常通知 e指明哪个参数接目标对象抛出的异常对象-->*  <aop:after-throwing method="myAfterThrowing"*  pointcut-ref="myPointcut"*  throwing="e">*  </aop:after-throwing>** @param e*///@AfterThrowing(value = "execution(* com.bjsxt.service.*.*(..))",throwing = "e")@AfterThrowing(value = "myPointcut()",throwing = "e")public void myAfterThrowing(Exception e) {System.out.println("Exception 2"+e);}
}

4.2.3.4.2配置切面

<?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"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/aophttp://www.springframework.org/schema/aop/spring-aop.xsd"><bean id="usersService" class="com.bjsxt.service.impl.UsersServiceImpl"></bean><bean id="myAspect" class="com.bjsxt.aop.MyAspect"></bean><bean id="myAspect2" class="com.bjsxt.aop.MyAspect2"></bean><!--在AspectJ框架中开启注解处理声名自动为ioc容器中的那些配置了@AaspectJ的切面的bean对象创建代理,织入:目标对象放进代理工厂生成代理对象的过程--><!--默认false 使用jdkproxy创建代理对象 true 使用cjlib创建代理对象--><!--目标对象实现接口 jdkproxy 没有实现 cglib--><aop:aspectj-autoproxy proxy-target-class="false"></aop:aspectj-autoproxy>
</beans>

结果

Spring框架学习笔记6-AOP编程-AspectJ方式相关推荐

  1. Spring框架学习笔记(三)(AOP,事务管理)

    Spring框架学习笔记(三) 九.AOP 9.1 AOP的注解配置 (1) 新建计算器核心功能(模拟:不能在改动核心代码) (2) 建立一个普通的Java类写增强代码(面向切面编程),使用Sprin ...

  2. Spring框架学习笔记,超详细!!(4)

    Java小白开始学习Spring框架,一方面,跟着视频学习,并记录下学习笔记,方便以后复习回顾.另一方面,发布学习笔记来约束自己,学习路程还很遥远,继续加油坚持!!!希望能帮助到大家! 另外还有我的牛 ...

  3. Spring框架学习笔记---完结

    一.简介 Spring:春天----->给软件行业带来了春天 2002年,Rod Jahnson首次推出了Spring框架雏形interface21框架. 2004年3月24日,Spring框架 ...

  4. Spring框架学习笔记(7)——代理对象实现AOP

    AOP(面向切面编程) AOP(Aspect-Oriented Programming, 面向切面编程): 是一种新的方法论, 是对传统 OOP(Object-Oriented Programming ...

  5. Spring.NET学习笔记13——AOP的概念(基础篇) Level 200

    上篇我们简单的了解了AOP的应用场景,知道AOP编程的重要性.这篇我们先看一段代码,来开始今天的学习. 回顾与上篇类似的代码:SecurityService类的IsPass判断用户名为"ad ...

  6. Spring框架学习笔记(1) ---[spring框架概念 , 初步上手使用Spring , 控制反转 依赖注入初步理解 ]

    spring官网 -->spring官网 spring5.3.12–>spring-framework 在线文档 --> Spring 5.3.12 文章目录 1.Spring概论 ...

  7. Spring.NET学习笔记15——AOP的配置(基础篇) Level 200

    上篇我学习了Spring.NET的四种通知类型,AOP的实现方案比较复杂,是通过代码实现的.而Spring.NET框架给我们提供了配置的方式来实现AOP的功能.到目前为止,我们已经讨论过使用Proxy ...

  8. Spring框架学习笔记01:初探Spring——采用Spring配置文件管理Bean

    文章目录 一.Spring概述 二.入门案例演示 (一)创建Maven项目[SpringDemo2021] (二)在pom.xml文件里添加依赖 场景:勇敢的骑士去完成杀龙的任务. (三)创建杀龙任务 ...

  9. Spring框架学习笔记05:Spring AOP基础

    文章目录 一.Spring AOP (一)AOP基本含义 (二)AOP基本作用 (三)AOP与OOP (四)AOP使用方式 (五)AOP基本概念 任务:骑士执行任务前和执行任务后,游吟诗人唱赞歌 (一 ...

  10. 从零写一个具有IOC-AOP-MVC功能的框架---学习笔记---07. AOP功能实现以及讲解

    1. 本章需要完成的内容 完成AspectListExecutor类的编写 完成AspectWeaver类的编写 完成PointcutLocator类的编写 完成ProxyCreator类的编写 2. ...

最新文章

  1. MySQL binlog
  2. eclipse集成maven插件
  3. Java static 静态代码块、代码块
  4. 你应该知道的 CSS 基础知识
  5. 软件使用方法_视频录制软件进行电脑屏幕录像的使用方法
  6. viper4android最新,ViPER4Android FX音效驱动下载-ViPER4Android音效驱动 v2.4.0.1 正式版_手机乐园...
  7. java多线程-基础知识
  8. 证书重新生成_Kubernates证书过期问题的解决
  9. go导出mysql中的excel表_golang web 开发 从数据库 导出到excel案例
  10. ssm毕设项目住宅小区停车管理系统494ak(java+VUE+Mybatis+Maven+Mysql+sprnig)
  11. [ZT]COMPAQ PROLIANT 8500上手动安装NetWare 4.11
  12. Latex输出大小写罗马数字
  13. 麻将判断胡牌 java_麻将胡牌逻辑 java
  14. 电子计算机与其它计算机工具的本质区别是,电子计算机与其他计算工具的本质区别是...
  15. 算法——Horner scheme
  16. 要多大内存才满足_什么是延迟满足能力?“延迟满足”能力对孩子有多重要家长要清楚...
  17. UWP中的Direct2D
  18. 怎么把电脑文件传到弹性云服务器,怎么把电脑文件传到弹性云服务器
  19. NPDP知识推送-第一章新产品开发战略(1)
  20. 2018清华计算机考研总结

热门文章

  1. 关于ADS-Matlab联合仿真ADS.RunSimulation()报错的解决方案
  2. 官方标配,吊炸天的 Linux 可视化管理工具,必须推荐给你
  3. 2022低压电工考题模拟考试平台操作
  4. 解压版mysql使用
  5. matlab中函数imhist的用法
  6. 学安全测试需要多少钱?安全测试培训费一般多少?
  7. ZZULIOJ.1706: 神奇的编码
  8. oracle trap,配置SNMP trap
  9. 可实现ffmpeg转码的cuda显卡
  10. [基于Python的微信公众号后台开发:1]配置对接阿里云服务器