/**
*
*/
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 最常用记录方法执行时间的更多相关文章

  1. Spring Data -Specification用法和常用查询方法(in,join,equal等)

    Spring Data -Specification用法和常用查询方法(in,join,equal等) 前言 入门例子 Repository层常用写法 Specification 的用法 总结 前言 ...

  2. spring 的 切片Aspect

    语法:  <aop:config> <!-- 配置多个切点,&& || ! --> <aop:pointcut id="pc" exp ...

  3. Spring注解开发-全面解析常用注解使用方法之生命周期

    本文github位置:https://github.com/WillVi/Spring-Annotation/ 往期文章:Spring注解开发-全面解析常用注解使用方法之组件注册 bean生命周期 ​ ...

  4. Spring学习之Aop的各种增强方法

    AspectJ允许使用注解用于定义切面.切入点和增强处理,而Spring框架则可以识别并根据这些注解来生成AOP代理.Spring只是使用了和AspectJ 5一样的注解,但并没有使用AspectJ的 ...

  5. Spring Aop实例@Aspect、@Before、@AfterReturning@Around 注解方式配置

    用过spring框架进行开发的人,多多少少会使用过它的AOP功能,都知道有@Before.@Around和@After等advice.最近,为了实现项目中的输出日志和权限控制这两个需求,我也使用到了A ...

  6. 【spring】spirng中的常用工具类

    一.概述 很多时候,很多工具类其实spring中就已经提供,常用的工具类有: 参考:https://www.cnblogs.com/langtianya/p/3875103.html 内置的resou ...

  7. Spring AOP 的@Aspect

    Spring AOP 的@Aspect   转自:http://blog.csdn.net/tanghw/article/details/3862987 从Spring 2.0开始,可以使用基于sch ...

  8. Spring AOP实例——异常处理和记录程序执行时间

    实例简介: 这个实例主要用于在一个系统的所有方法执行过程中出线异常时,把异常信息都记录下来,另外记录每个方法的执行时间. 用两个业务逻辑来说明上述功能,这两个业务逻辑首先使用Spring AOP的自动 ...

  9. jQuery操作Table tr td常用的方法

    虽然现在DIV+CSS进行页的布局大行其道,但是很多地方使用table还是有很多优势,用table展示数据是比较方便的,下面汇总了jQuery操作Table tr td常用的方法,熟记这些操作技巧,下 ...

随机推荐

  1. 黄聪:Pjax 无刷新开发web,更好用户体验

    什么Ajax.Pjax.Njax...神马玩意? 有Njax吗? 木有...不过真有Pjax!! 其实pjax就是用到了html5的新history api: pushState和replaceSta ...

  2. PHP在Linux下的套件LNMP

    LNMP官网:https://lnmp.org/install.html 另外不要忘了Azkaban和WhereHows

  3. [转][xml]SQL转义

    SQL语句包含">"和"<"时,在PL/SQL中可以正常运行,但是放在XML中,编译报错,这是因为在XML文档中的所有文本都会被解析器解析,文本内容 ...

  4. centos7图形化界面安装后,意外出现Please make your choice from above ['q' to quit | 'c' to continue | 'r' to refresh]

    安装完成centos7-GUI后出现如下提示: nitial setup of CentOS Linux (core) ) [x] Creat user ) [!] License informati ...

  5. spring 定时任务 scheduled Cron表达式

    转载:https://blog.csdn.net/u011789653/article/details/51153536 可以借鉴:https://www.cnblogs.com/softidea/p ...

  6. Java注解的基本概念和原理及其简单实用

      一.注解的基本概念和原理及其简单实用 注解(Annotation)提供了一种安全的类似注释的机制,为我们在代码中添加信息提供了一种形式化得方法,使我们可以在稍后某个时刻方便的使用这些数据(通过解析 ...

  7. c#day01

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace test ...

  8. linux下新建(touch)\复制(cp)\剪切(mv)\删除(rm)文件

    touch :新建多个文件,中间用空格隔开 touch file1 file2 cp: mv:剪切 rm:删除文件

  9. BCGcontrolBar(四) ListCtrl 操作输出显示

    Ribbon 的效果主要为在可停靠面板上放置各种组件 具体操作为新建一个watchbar 然后在watchbar上加入 ListCtrl组件 效果如下 因为是在可停靠面板上生成的 因此可以随意拖动 具 ...

  10. 第9章 应用层(4)_超文本传输协议HTTP

    5. 超文本传输协议HTTP 5.1 统一资源定位符URL (1)URL的一般形式:<协议>://<主机>:<端口>/<路径> ①协议后面必须写上“:/ ...