around

AOP称为面向切面编程,在程序开发中主要用来解决一些系统层面上的问题

微笑、不失礼 提交于 2020-05-07 19:53:35
AOP称为面向切面编程,在程序开发中主要用来解决一些系统层面上的问题,比如日志,事务,权限等待,Struts2的拦截器设计就是基于AOP的思想,是个比较经典的例子。 一 AOP的基本概念 (1)Aspect(切面):通常是一个类,里面可以定义切入点和通知 (2)JointPoint(连接点):程序执行过程中明确的点,一般是方法的调用 (3)Advice(通知):AOP在特定的切入点上执行的增强处理,有before,after,afterReturning,afterThrowing,around (4)Pointcut(切入点):就是带有通知的连接点,在程序中主要体现为书写切入点表达式 (5)AOP代理:AOP框架创建的对象,代理就是目标对象的加强。Spring中的AOP代理可以使JDK动态代理,也可以是CGLIB代理,前者基于接口,后者基于子类 二 Spring AOP Spring中的AOP代理还是离不开Spring的IOC容器,代理的生成,管理及其依赖关系都是由IOC容器负责,Spring默认使用JDK动态代理,在需要代理类而不是代理接口的时候,Spring会自动切换为使用CGLIB代理,不过现在的项目都是面向接口编程,所以JDK动态代理相对来说用的还是多一些。 三 基于注解的AOP配置方式 1.启用@AsjectJ支持 在applicationContext

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot ...

不羁岁月 提交于 2020-05-06 09:11:04
mysql 配置文件目录:/etc/my.cnf root 密码为空的时候配置文件中下面这句: skip-grant-tables GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY '123' WITH GRANT OPTION; 执行这句时候错误: ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement mysql> GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY '123' WITH GRANT OPTION; ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement 这个时候我们只需要 flush privileges 一下,在添加用户就OK了, mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> GRANT ALL PRIVILEGES ON *.*

D. Gourmet choice并查集,拓扑结构

微笑、不失礼 提交于 2020-05-06 03:39:51
D. Gourmet choice time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review — in each restaurant Mr. Apple orders two sets of dishes on two different days. All the dishes are different, because Mr. Apple doesn't like to eat the same food. For each pair of dishes from different days he remembers exactly which was

Flex布局基础知识

最后都变了- 提交于 2020-05-05 21:30:15
Flex布局 今天在学习css的时候,学到了一个新的布局方式:Flex布局(弹性盒布局)。本人认为挺重要的,首写博客来巩固一下自己今天所学的有关Flex布局的知识,并与大家分享,内容如有错误,欢迎大家来给我指点一下。 文章目录 Flex布局 Flex简介 弹性容器 弹性元素 主轴与纵轴 弹性容器样式 弹性元素样式 > 本章节使用的基础代码(开启flex之前) <style> .wrapper { width : 800px ; border : red solid 5px ; } .box1,.box2,.box3 { width : 100px ; height : 100px ; } .box1 { background-color : royalblue ; } .box2 { background-color : yellow ; } .box3 { background-color : salmon ; } </style> <body> <div class= "wrapper" > <div class= "box1" >1</div> <div class= "box2" >2</div> <div class= "box3" >3</div> </div> </body> Flex简介 Flex布局又称弹性盒布局,是css布局中的一个手段

微服务全链路跟踪:jaeger增加tag参数

我们两清 提交于 2020-05-05 21:16:19
微服务全链路跟踪:grpc集成zipkin 微服务全链路跟踪:grpc集成jaeger 微服务全链路跟踪:springcloud集成jaeger 微服务全链路跟踪:jaeger集成istio,并兼容uber-trace-id与b3 微服务全链路跟踪:jaeger集成hystrix 微服务全链路跟踪:jaeger增加tag参数 前言 > 微服务全链路跟踪:grpc集成jaeger 中介绍了springboot集成jaeger,在现实使用时很多情况下需要根据业务id来搜索全链路,这里就需要注入tab来方便搜索, 方案 1、直接手动注入 @Controller @RequestMapping("/demo") @Api(tags = "demo") @Slf4j public class DemoController extends BaseController { @Autowired private Tracer tracer; /** * */ @GetMapping("/getTaskByid") public ApiResponse getByid(@RequestParam("id") Long id) { if (tracer!=null&&tracer.activeSpan()!=null) { tracer.activeSpan().setTag(“id”, id);

flex 布局

拜拜、爱过 提交于 2020-05-04 12:08:17
FlexiableBox即是弹性盒,用来进行弹性布局,一般跟rem( rem伸缩布局(转) )连起来用比较方便,flexbox负责处理页面布局,然后rem处理一些flex顾及不到的地方(rem伸缩布局主要处理尺寸的适配问题),布局还是要传统布局的。 布局的传统解决方案,基于 盒状模型 ,依赖 display 属性 + position 属性 + float 属性。它对于那些特殊布局非常不方便,比如, 垂直居中 就不容易实现。 2009年,W3C提出了一种新的方案—-Flex布局,可以简便、完整、响应式地实现各种页面布局。目前,它已经得到了所有浏览器的支持,这意味着,现在就能很安全地使用这项功能。 Flex布局将成为未来布局的首选方案。本文介绍Flex布局的语法。 以下内容主要参考了下面两篇文章: A Complete Guide to Flexbox 和 A Visual Guide to CSS3 Flexbox Properties 。 一、Flex布局是什么? Flex是Flexible Box的缩写,意为”弹性布局”,用来为盒状模型提供最大的灵活性。 任何一个容器都可以指定为Flex布局。 .box{display:flex;} 行内元素也可以使用Flex布局。 .box{display:inline-flex;} Webkit内核的浏览器,必须加上-webkit前缀。

Spring AOP-高级详解【注意了哦】

谁都会走 提交于 2020-05-03 23:35:01
Spring A OP -高级 来,直上案例说明: 咻咻........ 一. 高级案例1:定义公共切入点 简述 切面类中会有很多通知,大部分通知的切入点都是相同的。 为了切入点 管理和维护更加方便,使用公共切入点。 @Pointcut 方法的修饰符:private 方法的返回值:void 方法无参数 方法无方法体 代码实现 切面类: (注意:标黄色是基于上篇新增的代码) @Component @Aspect public class MyAspect { @Pointcut ( "execution(* com.czxy.demo1.service..*.*(..))" ) private void myCut1(){} @AfterThrowing (value= " myCut1() " ,throwing = "ex" ) public void a1(JoinPoint joinPoint,Throwable ex){ System. out .println( "异常通知:" +joinPoint.getSignature().getName()+ "方法出异常了" +ex.getMessage()); } @AfterReturning (value= " myCut1() " ,returning = "obj" ) public void a2(JoinPoint

JavaWeb学习之Spring框架(一)

狂风中的少年 提交于 2020-05-03 21:00:30
Spring 负责管理项目中的所有对象, Spring 看作是项目中对象的管家 Spring 框架的功能: aop 支持、 ioc 思想、 spring jdbc 、 aop 事务、 junit 测试支持 Spring 搭建 : 导包: beans 、 context 、 core 、 exception 四个基础包 apache 日志包 创建实体类对象 书写配置文件:建议文件名为 applicationContext.xml 导入约束文件 Schema 约束 代码测试: 1 、创建容器对象 ApplicationContext ac=new ClassPathXmlApplicationContext(“applicationContext.xml”); 2、从容器中获得实体对象 User user=(User)ac.getBean(“User”); 3、打印该对象 System.out.println(user); Spring 思想: ioc: 反转控制 反转控制就是创建对象的方式反转了。以前对象的创建由开发人员自己维护,包括依赖关系也是自己注入;使用 spring 之后,对象的创建以及以来关系可以由 spring 完成创建以及注入。 反转控制就是反转了对象的创建方式。从我们自己创建反转给了程序 di: 依赖注入(注入就是赋值) 实现 ioc 思想需要 di 做支持

Autofac的切面编程实现

回眸只為那壹抹淺笑 提交于 2020-05-03 17:29:51
面向切面编程:Autofac.Annotation扩展组件是我开源的一款利用打标签完成autofac容器的注入组件。 https://github.com/yuzd/Autofac.Annotation 我们之前介绍了利用Aspect标签来完成拦截器功能 Aspect是一对一的方式,我想要某个class开启拦截器功能我需要针对每个class去配置。 详情请点击 比如说 我有2个 controller 每个controller都有2个action方法, [ Component ] public class ProductController { public virtual string GetProduct ( string productId ) { return "GetProduct:" + productId; } public virtual string UpdateProduct ( string productId ) { return "UpdateProduct:" + productId; } } [ Component ] public class UserController { public virtual string GetUser ( string userId ) { return "GetUser:" + userId; } public