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

中冶东北建设网站网络规划设计师教程第2版2021版pdf下载

中冶东北建设网站,网络规划设计师教程第2版2021版pdf下载,网站上怎么做支付接口,网站服务器崩溃一般多久可以恢复AOP-面向切面编程 AOP#xff1a;面向切面编程#xff0c;通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术。 SpringAop中#xff0c;通过Advice定义横切逻辑#xff0c;并支持5种类型的Advice#xff1a; 导入依赖 dependencygroupId面向切面编程通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术。 SpringAop中通过Advice定义横切逻辑并支持5种类型的Advice  导入依赖 dependencygroupIdorg.aspectj/groupIdartifactIdaspectjweaver/artifactIdversion1.9.4/version/dependency applicationContext.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:aophttp://www.springframework.org/schema/aopxsi:schemaLocationhttp://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 Spring 实现AOP的3种方式 1、使用Spring API  编写两个扩展功能的类Log、和AfterLog分别将添加到旧业务的前面和后面 Log类 import org.springframework.aop.MethodBeforeAdvice;import java.lang.reflect.Method;public class Log implements MethodBeforeAdvice {//method: 要执行的目标对象的方法//args: 参数//target: 目标对象Overridepublic void before(Method method, Object[] args, Object target) throws Throwable {System.out.println(target.getClass().getName()的method.getName()方法被执行了);}} AfterLog类 import org.springframework.aop.AfterReturningAdvice;import java.lang.reflect.Method;public class AfterLog implements AfterReturningAdvice {Overridepublic void afterReturning(Object result, Method method, Object[] objects, Object o1) throws Throwable {System.out.println(执行了method.getName()方法,返回结果为result);} } 配置spring配置文件  !--方式1--!--配置aop:需要导入aop的xsi信息--aop:config!--切入点 execution(要执行的位置)--aop:pointcut idpointcut expressionexecution(* com.study.service.UserServiceImpl.*(..))/!--执行环绕--aop:advisor advice-reflog pointcut-refpointcut/aop:advisor advice-refafterLog pointcut-refpointcut//aop:config 2、自定义类实现 编写一个自定义切面类 DiyPointCut public class DiyPointCut {public void before(){System.out.println(方法执行前);}public void after(){System.out.println(方法执行后);} } 配置spring配置文件 !--方式2--bean iddiy classcom.study.diy.DiyPointCut/aop:config!--自定义切面--aop:aspect refdiyaop:pointcut idpoint expressionexecution(* com.study.service.UserServiceImpl.*(..))/aop:before methodbefore pointcut-refpoint/aop:after methodafter pointcut-refpoint//aop:aspect/aop:config 3、使用注解实现AOP 编写类 import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before;//使用注解实现AOP 标注这个类为一个切面 Aspect public class AnnotationPointCut {Before(execution(* com.study.service.UserServiceImpl.*(..)))public void before(){System.out.println(方法之前执行);} } 编写配置文件 !--方式3--bean idannotationPointCut classcom.study.diy.AnnotationPointCut/!--开启注解支持!--aop:aspectj-autoproxy/
http://www.zqtcl.cn/news/793892/

相关文章:

  • 做自己的卡盟网站做技术一般逛那些网站
  • 网站建设自学多长时间做网站原型的软件
  • 营销型的物流网站模板北京楼市最新消息
  • 宁波模版建站公司湘潭建设网站公司
  • 世界十大网站排名出炉最新军事新闻最新消息视频
  • 医疗电子的网站建设城市建设管理
  • win10建站wordpress商城网站结算页面怎么做
  • 电商网站模板引擎惠阳做网站公司
  • 如何在百度做网站推广中企动力企业邮箱手机邮箱
  • extjs做的网站开发公司宣传语
  • 长安做外贸网站关于阅读类网站的建设规划书
  • php网站建设思路方案阿里巴巴如何建设网站
  • 网站做什么推广好网站域名注册步骤
  • 官方建网站有哪些步骤国内成熟的crm系统
  • 建设银行深圳天健世纪支行网站电子商务网站建设员
  • 个人备案域名可以做企业网站吗海南做公司网站
  • 浙江坤宇建设有限公司网站施工企业施工生产计划
  • 成都建站推广域名备案用的网站建设方案
  • 西安市城乡建设管理局网站6一级域名生成二级域名
  • 网站建设沙漠风服装公司网站源码
  • 体检营销型网站php网站建设培训班
  • 做洁具最好的网站数据分析
  • 郑州网站建设丶汉狮网络网站建设中图片是什么意思
  • 深圳网站建设公司设计公司做影视网站用主机还是用服务器
  • 网站建设价格如何做问卷调查网站
  • 网络营销推广合同天津网站seo策划
  • 明年做那个网站致富wordpress loper
  • 网站开发原理柳州网站推广
  • 杭州高端网站开发重庆网站建设去迅法网
  • 营销型网站建设调查表用flash做游戏下载网站