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

江门网站seo关键词排名优化网上房地产查询

江门网站seo关键词排名优化,网上房地产查询,开发一个商城需要多少钱,安徽建新建设工程有限公司网站目录 AOP(术语)引入依赖实现步骤测试验证感谢阅读 AOP(术语) 连接点 类里面哪些方法可以增强#xff0c;这些点被称为连接点 切入点 实际被真正增强的方法 通知#xff08;增强#xff09; 实际增强的逻辑部分称为通知#xff08;增强#xff09; 通知#xff08;增强这些点被称为连接点 切入点 实际被真正增强的方法 通知增强 实际增强的逻辑部分称为通知增强 通知增强有多种类型 前置通知–Before后置通知–After环绕通知–Around异常通知–AfterThrowing最终通知–AfterReturning 切面是动作– 把通知增强应用到切入点过程 引入依赖 dependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-aop/artifactId/dependency/dependencies实现步骤 新建一个注解类用于后面做切入点 Retention(value RetentionPolicy.RUNTIME) Target(ElementType.METHOD) public interface Authorization {}建一个切面类 Aspect Component public class AuthAspect {/*** 定义了一个切点* 这里的路径填自定义注解的全路径*/Pointcut(annotation(com.zhuyh.studytest.spring5.aop.Authorization))public void authornizeCut() {}Before(authornizeCut())public void cutProcess(JoinPoint joinPoint) {MethodSignature signature (MethodSignature) joinPoint.getSignature();Method method signature.getMethod();System.out.println(AOP开始拦截, 当前拦截的方法名: method.getName());}After(authornizeCut())public void after(JoinPoint joinPoint) {MethodSignature signature (MethodSignature) joinPoint.getSignature();Method method signature.getMethod();System.out.println(AOP执行的方法 : method.getName() 执行完了);}Around(authornizeCut())public Object testCutAround(ProceedingJoinPoint joinPoint) throws Throwable {System.out.println(AOP拦截开始进入环绕通知.......);Object proceed joinPoint.proceed();System.out.println(准备退出环绕......);return proceed;}/*** returning属性指定连接点方法返回的结果放置在result变量中** param joinPoint 连接点* param result 返回结果*/AfterReturning(value authornizeCut(), returning result)public void afterReturn(JoinPoint joinPoint, Object result) {MethodSignature signature (MethodSignature) joinPoint.getSignature();Method method signature.getMethod();System.out.println(AOP拦截的方法执行成功, 进入返回通知拦截, 方法名为: method.getName() , 返回结果为: result.toString());}AfterThrowing(value authornizeCut(), throwing e)public void afterThrow(JoinPoint joinPoint, Exception e) {MethodSignature signature (MethodSignature) joinPoint.getSignature();Method method signature.getMethod();System.out.println(AOP进入方法异常拦截, 方法名为: method.getName() , 异常信息为: e.getMessage());} }来一个Controller作为请求被代理的对象 RestController RequestMapping(/company) public class CompanyController {GetMapping(/aopTest)Authorizationpublic Object aopTest(RequestParam String name){//远程调用System.out.println(执行接口name: name);// int n 1/0;return 成功了----- name;} }启动类启动项目 SpringBootApplication public class StudyTestApplication {public static void main(String[] args) {SpringApplication.run(StudyTestApplication.class, args);} }测试验证 浏览器或者api调用工具调接口 控制台打印 AOP拦截开始进入环绕通知....... AOP开始拦截, 当前拦截的方法名: aopTest 执行接口name:zhuyh AOP拦截的方法执行成功, 进入返回通知拦截, 方法名为: aopTest, 返回结果为: 成功了-----zhuyh AOP执行的方法 :aopTest 执行完了 准备退出环绕......Controller加入一个异常 int i1/0; 重启项目再次调用 异常通知打印了 / by zero AOP拦截开始进入环绕通知....... AOP开始拦截, 当前拦截的方法名: aopTest 执行接口name:zhuyh AOP进入方法异常拦截, 方法名为: aopTest, 异常信息为: / by zero AOP执行的方法 :aopTest 执行完了 2024-01-24 16:50:10.477 ERROR 4888 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.ArithmeticException: / by zero] with root causejava.lang.ArithmeticException: / by zeroat com.zhuyh.studytest.spring5.aop.CompanyController.aopTest(CompanyController.java:16) ~[classes/:na]感谢阅读 谢谢您的陪伴 如果您有任何问题、建议或想要了解的特定主题请随时在评论中告诉我们。期待与您共同探索java共同提升我们的Java开发技能
http://www.hkea.cn/news/14513742/

相关文章:

  • 手机网站建网wordpress模板缩略图代码
  • 网站手机端的优势备案个人网站
  • 外贸网站设计公司价格wordpress nginx配置伪静态
  • 能接做网站的活的网站网页定制哪家不错
  • 宁波网站推广优化公司怎么样洛阳市副市长到省建设厅网站
  • 怎么在自己的网站上做漂浮链接罗湖附近网站建设公司
  • 北京网站建设在线广州网站开发费用
  • 网站服务器出错了怎么办网站域名空间一年费用是多少钱
  • dedecms三合一网站源码公众号商城怎么开
  • 深圳建设集团网站首页微信运营技巧
  • 做网站好还是网页好住建局官网查询入口
  • 城市建设与管理局网站电影聚合网站开发
  • 高端建站费用吉林网络营销方式优化
  • 网站建设肆金手指排名7美术馆网站建设方案
  • 批量查询网站是否正常wordpress中调整图片尺寸
  • 秦皇岛手机网站抚顺网站制作
  • 做网站第一成都专业网站建设机构
  • 做网站交易装备可以么建设代刷网站
  • 潍坊网站制作小程序济南网站优化收费标准
  • 网站建设低价建站室内设计培训多久
  • 龙元建设网站小榄做网站企业
  • 招聘网站如何做运营北京全网营销推广公司
  • 织梦商城网站做磁力链网站
  • 做家常菜的网站哪个好学软件工程好找工作吗
  • 网络热词2022流行语及解释关键词排名优化方案
  • 怎样建个自己的网站怎样给网站加外链
  • 长清网站建设大连企业网站建站模板
  • 温州中小企业网站建设苏州百度推广分公司电话
  • 创建站点的步骤广州微信开发
  • 手提包 东莞网站建设免费网站在哪下载