当前位置: 首页 > news >正文

网站的专区怎么建设原创软文

网站的专区怎么建设,原创软文,做简历网站 知乎,wordpress ios版本一、什么是AOP#xff1f;在不修改源代码的情况下 增加功能二、底层是什么#xff1f;动态代理aop是IOC的一个扩展功能#xff0c;现有IOC#xff0c;再有AOP#xff0c;只是在IOC的整个流程中新增的一个扩展点而已#xff1a;BeanPostProcessorbean的创建过程中有一个步…一、什么是AOP在不修改源代码的情况下 增加功能二、底层是什么动态代理aop是IOC的一个扩展功能现有IOC再有AOP只是在IOC的整个流程中新增的一个扩展点而已BeanPostProcessorbean的创建过程中有一个步骤可以对bean进行扩展实现AOP本身就是一个扩展功能所以BeanPostProcessor的后置处理方法来进行实现三、术语①、连接点在一个类里面哪些方法可以被增强这些方法就称为连接点②、切入点实际被真正增强的方法称为切入点③、通知增强实际增强的逻辑部分称为通知增强通知有多种类型前置通知后置通知环绕通知异常通知最终通知④、切面把通知应用到切入点的过程四、AOP操作Spring框架一般都是基于AspectJ实现AOP操作什么是AspectJ不是Spring组成部分独立AOP框架一般把AspectJ和Spring框架一起使用进行AOP操作基于AspectJ实现AOP操作基于xml配置方式基于注解方式一、注解方式引入AOP依赖开启注解扫描开启Aspect生成代理对象 User类package com.atguigu.spring5.AOP;import org.springframework.stereotype.Component;/*** BelongsProject: 02-Spring* BelongsPackage: com.atguigu.spring5.AOP* Author: dengLiMei* CreateTime: 2023-02-11 19:54* Description: TODO* Version: 1.0*/ //被增强类 Component public class User {public void add() {System.out.println(add……);} }UserProxy类package com.atguigu.spring5.AOP;import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component;/*** BelongsProject: 02-Spring* BelongsPackage: com.atguigu.spring5.AOP* Author: dengLiMei* CreateTime: 2023-02-11 19:55* Description: TODO* Version: 1.0*/ //增强的类 Component Aspect //生成代理对象 public class UserProxy {//前置通知//Before注解表示作为前置通知Before(value execution(* com.atguigu.spring5.AOP.User.add()))public void before() {System.out.println(before.....);}//最终通知方法之后就执行有异常也执行After(value execution(* com.atguigu.spring5.AOP.User.add()))public void After() {System.out.println(After.....);}//后置通知返回通知在返回结果之后执行有异常不执行AfterReturning(value execution(* com.atguigu.spring5.AOP.User.add()))public void AfterReturning() {System.out.println(AfterReturning.....);}//异常通知有异常了才执行没异常不执行AfterThrowing(value execution(* com.atguigu.spring5.AOP.User.add()))public void AfterThrowing() {System.out.println(AfterThrowing.....);}//环绕通知//表示在方法之前和方法之后都执行Around(value execution(* com.atguigu.spring5.AOP.User.add()))public void Around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {System.out.println(环绕之前.....);//被增强的方法执行proceedingJoinPoint.proceed();System.out.println(环绕之后.....);} }Main类package com.atguigu.spring5.AOP;import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;/*** BelongsProject: 02-Spring* BelongsPackage: com.atguigu.spring5.AOP* Author: dengLiMei* CreateTime: 2023-02-11 20:05* Description: TODO* Version: 1.0*/ public class Main {public static void main(String[] args) {ApplicationContext context new ClassPathXmlApplicationContext(aopbean.xml);User user context.getBean(user, User.class);user.add();} }输出结果问题对指定类的指定方法做增强解决对相同切入点进行抽取PersonProxy类在上面例子基础上增加一个新类package com.atguigu.spring5.AOP;import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component;/*** BelongsProject: 02-Spring* BelongsPackage: com.atguigu.spring5.AOP* Author: dengLiMei* CreateTime: 2023-02-11 20:21* Description: TODO* Version: 1.0*/ Component Aspect Order(1) public class PersonProxy {//后置通知返回通知Before(value execution(* com.atguigu.spring5.AOP.User.add(..)))public void afterReturning(){System.out.println(Person Before……);} }输出结果有多个增强类对同一个方法进行增强设置增强类优先级在增强类上面增加注解Order数字类型值数字类型值越小优先级越高二、AspectJ配置方式创建对象配置aop增强 切入点配置切面Book类package com.atguigu.spring5.AOP.AOPConfigue;/*** BelongsProject: 02-Spring* BelongsPackage: com.atguigu.spring5.AOP.AOPConfigue* Author: dengLiMei* CreateTime: 2023-02-11 20:38* Description: TODO* Version: 1.0*/ public class Book {public void buy(){System.out.println(买);} }BookProxy类package com.atguigu.spring5.AOP.AOPConfigue;/*** BelongsProject: 02-Spring* BelongsPackage: com.atguigu.spring5.AOP.AOPConfigue* Author: dengLiMei* CreateTime: 2023-02-11 20:40* Description: TODO* Version: 1.0*/ public class BookProxy {public void before(){System.out.println(before……);} }Main类package com.atguigu.spring5.AOP.AOPConfigue;import com.atguigu.spring5.AOP.AOPAnnotation.User; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;/*** BelongsProject: 02-Spring* BelongsPackage: com.atguigu.spring5.AOP.AOPConfigue* Author: dengLiMei* CreateTime: 2023-02-11 20:44* Description: TODO* Version: 1.0*/ public class Main {public static void main(String[] args) {ApplicationContext context new ClassPathXmlApplicationContext(aopbean2.xml);Book book context.getBean(book, Book.class);book.buy();} }输出结果 Spring系列文章Spring——是什么作用内容用到的设计模式Spring——Bean管理-xml方式进行属性注入Spring——Bean管理-注解方式进行属性注入Spring——什么是IOCSpring——AOP是什么?如何使用Spring——什么是事务传播行为事务隔离级别有哪些Spring——整合junit4、junit5使用方法如果有想要交流的内容欢迎在评论区进行留言如果这篇文档受到了您的喜欢那就留下你点赞收藏脚印支持一下博主~
http://www.hkea.cn/news/14468824/

相关文章:

  • 乐都网站建设多少钱做招聘网站还有法盈利吗
  • 广西钦州网站建设线上平台名称大全
  • 迷失传奇网站naocq网站关键字搜索功能
  • 网站页面开发流程如果创建网站
  • 企业站seo报价安徽网站建设认准-晨飞网络
  • 正规的丹阳网站建设网站怎么做来流量吗
  • 做网站还需要买空间吗wordpress改主题幻灯片尺寸
  • 做音乐网站需要什么城阳网站建设公司电话
  • 长春专业网站制作公司温州网站建设及推广
  • 嘉兴做网站美工的工作河北seo关键词排名优化
  • 深圳外贸网站建设制作方法建设手机网站设计
  • 做网站挣钱快又多网站建设需要用到什么软件有哪些
  • 网站要怎么建立怎么样做企业网站
  • 关于做网站的毕业设计网站推广策略什么时候
  • 工程建设管理网站洛阳霞光seo网络公司
  • 一级a做爰片免费网站在线公司软件管理软件
  • 营销网站的专业性诊断评价和优化网店代运营网站
  • wordpress admin_init深圳优化网站
  • 做电影网站代理合法么移动应用开发和网站开发
  • 购物网站怎么做优化wordpress 连接丢失.保存已被禁用_直到您重新连接.
  • 58做网站天津网站搜索排名
  • wordpress能开发商城网站吗网页制作与设计代码
  • 太原模板建站平台东莞大岭山中学
  • 响应式网站内容布局深圳外贸公司多吗
  • 网站APP注册做任务上海网站排名优化推荐
  • 初学php者网站首页怎么做网站查询访问域名
  • 网店代运营网站做网站公司东莞
  • 微信链接网站怎么做的网站建设策划书主要内容
  • 平台型网站建设预算表wordpress分类别名
  • 做电脑网站宽度公司营销型网站公司