spring aop execution用法
代码结构:

1、
"execution(* com.ebc..*.*(..))" 与 "execution(* com.ebc..*(..))"
2019-01-29 09:38:28.230 [5c4fae94cbb0aa9e2110d155] INFO | c.e.w.IndexController.index:23 - controller接收:遥远2
2019-01-29 09:38:28.237 [5c4fae94cbb0aa9e2110d156] INFO | c.e.s.IndexService.doIndex:11 - service接收:遥远2
2、
@Pointcut("execution(* com.ebc.web.*.*(..))") 与@Pointcut("execution(* com.ebc.web.IndexController.*(..))")【本例是相同的】
2019-01-29 09:48:37.152 [5c4fb0f5cbb09a4ade3280b6] INFO | c.e.w.IndexController.index:23 - controller接收:遥远2
2019-01-29 09:48:37.152 [5c4fb0f5cbb09a4ade3280b6] INFO | c.e.s.IndexService.doIndex:11 - service接收:遥远2
3、
@Pointcut("@within(org.springframework.stereotype.Controller) || @within(org.springframework.web.bind.annotation.RestController)")
2019-01-29 09:51:26.951 [5c4fb19ecbb01db5f6fd96b9] INFO | c.e.w.IndexController.index:23 - controller接收:遥远2
2019-01-29 09:51:26.952 [5c4fb19ecbb01db5f6fd96b9] INFO | c.e.s.IndexService.doIndex:11 - service接收:遥远2
注意:如果使用aop做MDC日志,切入点只能在入口类。否则,每个类输出的都是不同的数值。
spring aop execution用法的更多相关文章
- spring AOP的用法
AOP,面向切面编程,它能把与核心业务逻辑无关的散落在各处并且重复的代码给封装起来,降低了模块之间的耦合度,便于维护.具体的应用场景有:日志,权限和事务管理这些方面.可以通过一张图来理解下: Spri ...
- Spring AOP execution表达式
Spring中事务控制相关配置: <bean id="txManager" class="org.springframework.jdbc.datasource.D ...
- Spring AOP 和 动态代理技术
AOP 是什么东西 首先来说 AOP 并不是 Spring 框架的核心技术之一,AOP 全称 Aspect Orient Programming,即面向切面的编程.其要解决的问题就是在不改变源代码的情 ...
- Spring系列(四):Spring AOP详解
一.AOP是什么 AOP(面向切面编程),可以说是一种编程思想,其中的Spring AOP和AspectJ都是现实了这种编程思想.相对OOP(面向过程编程)来说,提供了另外一种编程方式,对于OOP过程 ...
- Spring+AOP+Log4j 用注解的方式记录指定某个方法的日志
一.spring aop execution表达式说明 在使用spring框架配置AOP的时候,不管是通过XML配置文件还是注解的方式都需要定义pointcut"切入点" 例如定义 ...
- Spring Aop(一)——Aop简介
转发地址:https://www.iteye.com/blog/elim-2394629 1 Aop简介 AOP的全称是Aspect Oriented Programming,翻译成中文是面向切面编程 ...
- Spring5.0源码学习系列之Spring AOP简述
前言介绍 附录:Spring源码学习专栏 在前面章节的学习中,我们对Spring框架的IOC实现源码有了一定的了解,接着本文继续学习Springframework一个核心的技术点AOP技术. 在学习S ...
- Java Spring AOP用法
Java Spring AOP用法 Spring AOP Java web 环境搭建 Java web 项目搭建 Java Spring IOC用法 spring提供了两个核心功能,一个是IoC(控制 ...
- 框架源码系列十:Spring AOP(AOP的核心概念回顾、Spring中AOP的用法、Spring AOP 源码学习)
一.AOP的核心概念回顾 https://docs.spring.io/spring/docs/5.1.3.RELEASE/spring-framework-reference/core.html#a ...
随机推荐
- floyd路径记录
#include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #in ...
- JPA entityManagerFactory配置详解
以下是本人的一些理解 如有误的地方欢迎指出 谢谢! jpa.LocalContainerEntityManagerFactoryBean 与 hibernate的sessionFactory一样都实现 ...
- [gist]Android SHA-1
参考:http://stackoverflow.com/questions/5980658/how-to-sha1-hash-a-string-in-android 代码:
- Luogu 2737 [USACO4.1]麦香牛块Beef McNuggets
NOIP2017 D1T1 的结论,两个数$a, b$所不能表示出的最大的数为$a * b - a - b$. 听了好几遍证明我还是不会 注意到本题中给出的数都非常小,所以最大不能表示出的数$\leq ...
- 及时修改jira的状态
领到一个task,然后,修改task状态为开发状态,并且,点击edit,选择,story points,预估自己这个task大概做几天. 做完task后,再修改task的状态
- [转]JQ中$(window).load和$(document).ready区别与执行顺序
一.$(window).load().window.onload=function(){}和$(document).ready()方法的区别 1.$(window).load() 和window.on ...
- js setTime()详解
来源:http://www.jb51.net/article/35535.htm#t1 setTimeout setTimeout 语法例子 用 setTimeout 来执行 function 不断重 ...
- python之编辑器pycharm
在进行python开发的时候,习惯使用pycharm这个编辑器进行开发工作,总结一些常用到的功能点 常用功能: 1. 打开当前文件所在的目录 在文件右击 -> Show in Exploer ...
- 659. Split Array into Consecutive Subsequences
You are given an integer array sorted in ascending order (may contain duplicates), you need to split ...
- JS随机数生成算法
------------------------------------------ 知乎上边淘到的知识,又学到了~ http://www.zhihu.com/question/22818104 -- ...