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

个人网站上传有啥要求山东网站建设平台

个人网站上传有啥要求,山东网站建设平台,榜单优化,建设和住房保障部 网站目录 什么是AOP#xff1f;AOP组成Spring AOP 实现步骤Spring AOP实现原理JDK Proxy VS CGLIB 什么是AOP#xff1f; AOP#xff08;Aspect Oriented Programming#xff09;#xff1a;⾯向切⾯编程#xff0c;它是⼀种思想#xff0c;它是对某⼀类事情的集中处理。⽐如… 目录 什么是AOPAOP组成Spring AOP 实现步骤Spring AOP实现原理JDK Proxy VS CGLIB 什么是AOP AOPAspect Oriented Programming⾯向切⾯编程它是⼀种思想它是对某⼀类事情的集中处理。⽐如⽤户登录权限的效验没学 AOP 之前我们所有需要判断⽤户登录的⻚⾯中的⽅法都要各⾃实现或调⽤⽤户验证的⽅法然⽽有了 AOP 之后我们只需要在某⼀处配置⼀下所有需要判断⽤户登录⻚⾯中的⽅法就全部可以实现⽤户登录验证了不再需要每个⽅法中都写相同的⽤户登录验证了。 AOP组成 切面(Aspect)定义的是事件(AOP是啥的)。ex用户登录校验切点(Pointcut)定义具体规则。ex定义用户登录拦截规则哪些接口判断用户登录权限哪些不判断。通知(Advice)AOP执行的具体方法。ex获取用户登录信息如果获取到说明已经登录否则未登录。 前置通知 后置通知 环绕通知 返回通知连接点(Join Point)有可能触发切点的所有点。ex所有接口 Spring AOP 实现步骤 1.添加Spring AOP依赖 !-- https://mvnrepository.com/artifact/org.springframework.boot/spring-bo ot-starter-aop -- dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-aop/artifactId /dependency2.定义切面。 package com.example.demo.common;import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.stereotype.Component;Aspect // 定义切面 Component public class UserAspect { } 3.定义切点。 package com.example.demo.common;import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.stereotype.Component;Aspect // 定义切面 Component public class UserAspect {// 切点Pointcut(execution(* com.example.demo.controller.UserController.*(..)))public void pointcut() {} } 4.执行通知。 package com.example.demo.common;import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.stereotype.Component;Aspect // 定义切面 Component public class UserAspect {// 切点Pointcut(execution(* com.example.demo.controller.UserController.*(..)))public void pointcut() {}// 通知Before(pointcut())public void doBefore() {System.out.println(执行了前置通知);} } package com.example.demo.common;import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; import org.springframework.stereotype.Component;Aspect // 定义切面 Component public class UserAspect {// 切点Pointcut(execution(* com.example.demo.controller.UserController.*(..)))public void pointcut() {}// 通知Before(pointcut())public void doBefore() {System.out.println(执行了前置通知);}// 后置通知After(pointcut())public void doAfter() {System.out.println(执行了后置方法);}// 环绕通知Around(pointcut())public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {System.out.println(环绕通知执行之前);// 执行目标方法Object result joinPoint.proceed();System.out.println(环绕通知执行之后);return result;} } Spring AOP实现原理 Spring AOP 是构建在动态代理基础上因此 Spring 对 AOP 的⽀持局限于⽅法级别的拦截。 Spring 动态代理组成 1.JDK Proxy 代理对象必须实现接口才能使用JDK Proxy 。 2.CGLIB 通过实现代理类的子类来实现动态代理。 JDK Proxy VS CGLIB 1.出生不同。 2.实现不同JDK Proxy要求代理类实现接口才能实现代理 CGLIB 是通过实现子类完成动态代理。 3.性能不同JDK 7 JDK Proxy性能是略高于CGLIB JDK 7之前 CGLIB 性能远远高于JDK Proxy。
http://www.yingshimen.cn/news/38282/

相关文章:

  • 做网站安全维护是什么东东wordpress忘记密码ftp
  • 卖友情链接的哪来那么多网站电脑版qq手机登录网页登录入口
  • ie8打不开建设银行网站昆明体育城微网站建设
  • 沈阳网站建设工作顺企网南昌网站建设
  • 高端网网站建设慧聪网seo页面优化
  • 网站建设为什么这么贵wordpress my02visitors
  • 平面设计网站制作天津装饰公司排行榜前十位有哪些
  • 用织梦做的手机网站怎么才能和电脑同步宁波网页设计职业
  • 手机网站输入框中山网站建设文化策划
  • 贵州省网站集约化建设wordpress上注入
  • 高端网站制作软件如何修改网站后台登陆入口路劲
  • 毕设做网站和app重庆妇科医院在线咨询
  • 如何做网站清风制作沈阳定制网带式电加热烘箱
  • 电子商务网站发展建设论文网站制作需要什么资料
  • 中小学网站建设论文wordpress连不上
  • 做ps彩图什么网站好用什么网站做封面最好
  • 高性能的网站建设指南长春企业自助建站
  • 成都网站建设定制开发系统srm采购管理系统
  • 江西营销网站建设php网站开发流程逻辑
  • 如何在手机上做微电影网站如何做网站优化
  • 网站开发的实训报告太原网站建设制作公司哪家好
  • 已有域名怎么做网站哪里有网站开发定制
  • 在线做任务的网站有哪些青海网站开发建设
  • 企业网站推广外包江苏大丰做网站
  • 高质量的赣州网站建设网页制作的原则是什么
  • 网站首页制作教程中国历任总经理名单
  • wordpress所有文章新窗口打开东莞seo推广优化排名
  • 做一个app的成本seovip培训
  • 百度云建站WordPress郑州东区做网站电话
  • 公司创建网站多少钱asp.net mvc 网站开发