spring 的 切片Aspect 最常用记录方法执行时间
/**
*
*/
package com.icil.esolution.aspect; import java.util.Date; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; /**
*
*@ClassName: TimeAspect
*
* @Description:
*
* @Author: Sea
*
* @Date: 16 Oct 2018 7:18:40 PM
*
*
* @Copyright: 2018 icil . All rights reserved.
*/
@Aspect
@Component
public class TimeAspect { private static Logger logger =LoggerFactory.getLogger(TimeAspect.class); // @Around("execution(* com.sea.web.controller.UserController.*(..))") //com.icil.esolution.service.impl
@Around("execution(* com.icil.esolution.controller.*.*(..))")
public Object handleControllerMethod(ProceedingJoinPoint pjp) throws Throwable { long start = new Date().getTime(); Object object = pjp.proceed(); String costTime= (new Date().getTime() - start)+"";
String methodName = pjp.getSignature().getName();
logger.info("*************** Run the method --> {} total cost time is {} ms********************",methodName,costTime); return object;
} }
spring 的 切片Aspect 最常用记录方法执行时间的更多相关文章
- Spring Data -Specification用法和常用查询方法(in,join,equal等)
Spring Data -Specification用法和常用查询方法(in,join,equal等) 前言 入门例子 Repository层常用写法 Specification 的用法 总结 前言 ...
- spring 的 切片Aspect
语法: <aop:config> <!-- 配置多个切点,&& || ! --> <aop:pointcut id="pc" exp ...
- Spring注解开发-全面解析常用注解使用方法之生命周期
本文github位置:https://github.com/WillVi/Spring-Annotation/ 往期文章:Spring注解开发-全面解析常用注解使用方法之组件注册 bean生命周期 ...
- Spring学习之Aop的各种增强方法
AspectJ允许使用注解用于定义切面.切入点和增强处理,而Spring框架则可以识别并根据这些注解来生成AOP代理.Spring只是使用了和AspectJ 5一样的注解,但并没有使用AspectJ的 ...
- Spring Aop实例@Aspect、@Before、@AfterReturning@Around 注解方式配置
用过spring框架进行开发的人,多多少少会使用过它的AOP功能,都知道有@Before.@Around和@After等advice.最近,为了实现项目中的输出日志和权限控制这两个需求,我也使用到了A ...
- 【spring】spirng中的常用工具类
一.概述 很多时候,很多工具类其实spring中就已经提供,常用的工具类有: 参考:https://www.cnblogs.com/langtianya/p/3875103.html 内置的resou ...
- Spring AOP 的@Aspect
Spring AOP 的@Aspect 转自:http://blog.csdn.net/tanghw/article/details/3862987 从Spring 2.0开始,可以使用基于sch ...
- Spring AOP实例——异常处理和记录程序执行时间
实例简介: 这个实例主要用于在一个系统的所有方法执行过程中出线异常时,把异常信息都记录下来,另外记录每个方法的执行时间. 用两个业务逻辑来说明上述功能,这两个业务逻辑首先使用Spring AOP的自动 ...
- jQuery操作Table tr td常用的方法
虽然现在DIV+CSS进行页的布局大行其道,但是很多地方使用table还是有很多优势,用table展示数据是比较方便的,下面汇总了jQuery操作Table tr td常用的方法,熟记这些操作技巧,下 ...
随机推荐
- Java第01次实验提纲(基本概念+编程环境入门+PTA)
0. 控制台下编译.运行 在Notepad++编写Java程序 学会使用控制台,javac.java 学会使用Notepad++ 参考资料: 控制台-cmd应用基础 扫盲教程 使用命令行编译并运行ja ...
- pytest.7.常见套路
From: http://www.testclass.net/pytest/common_useage/ 在使用pytest的时候,下面这些问题我们可能会经常遇到,这里给出官方的解决方案,按照套路来执 ...
- P1096(简单dp)
题目描述 在N个数中找出其和为M的若干个数.先读入正整数N(1< N< 100)和M(1< M< 10000), 再读入N个正数(可以有相同的数字,每个数字均在1000以内) ...
- mybatisz中一个可以替代between..and 的技巧
用mybatis进行时间段筛选时,如果,查询本日,本月的信息量,我们可以使用like concat()函数来替换between..and <select id="queryMyStaf ...
- Scrapy学习篇(六)之Selector选择器
当我们取得了网页的response之后,最关键的就是如何从繁杂的网页中把我们需要的数据提取出来,python从网页中提取数据的包很多,常用的有下面的几个: BeautifulSoup它基于HTML代码 ...
- sqlserver in 和 exist 子查询
1 in 子查询 use StudentManageDB go --select StudentName from Students --where StudentId=(select Student ...
- sp_settriggerorder 设置触发器执行顺序
sp_settriggerorder (Transact-SQL) 本主题适用于:SQL Server(从 2008 开始)Azure SQL 数据库Azure SQL 数据仓库并行数据仓库 ...
- Jquery的框架解析
最近闲的刁痛,想看看jQuery源码.但是这个源码看起来 还是挺费劲的.所以呢整理一份框架出来, 避免走入jQuery关键字的误区,我用Gys代替关键字jQuery. 下面是源码: (function ...
- Linux之间用SSH传输文件 一行命令实现
把本机的文件传到目标: cd /home/ && tar czv test | ssh root@HostIP -p 22 'tar xz' 解释: 如你所见,这行命令其实由多个命令组 ...
- php创建临时表
$sql= "create temporary table yc_linshi ( img varchar(100) not null, openid varchar(50) not nul ...