Spring 全注解配置 bean 和 调用 (9) 5种通知
来源:互联网 发布:深入浅出node.js系列 编辑:程序博客网 时间:2024/06/06 11:44
package com.xiuye.config.aspect;import org.aspectj.lang.ProceedingJoinPoint;import org.aspectj.lang.annotation.After;import org.aspectj.lang.annotation.AfterReturning;import org.aspectj.lang.annotation.AfterThrowing;import org.aspectj.lang.annotation.Around;import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang.annotation.Before;import org.aspectj.lang.annotation.Pointcut;/*import org.springframework.context.annotation.Configuration;import org.springframework.stereotype.Component;*/@Aspect//@Configurationpublic class AspectConfig {@Before("execution(** com.xiuye.component.*.description())")public void beforeDescription(){System.out.println("Before method:description!");}@Pointcut("execution(** com.xiuye.component.*.description())")public void description(){}@After("description()")public void afterDescription(){System.out.println("After method:description!");}@AfterReturning("description()")public void afterReturningDescription(){System.out.println("AfterReturning method:description!");}@AfterThrowing("description()")public void afterThrowingDescription(){System.out.println("AfterThrowing method:description!");}@Around("description()")//始终在其通知前面执行public void aroundDescription(ProceedingJoinPoint jp){System.out.println("Around method:description!");System.out.println("Hello World!");try {jp.proceed();} catch (Throwable e) {e.printStackTrace();}System.out.println("Is game over?!");}}
十一月 12, 2016 7:59:21 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getDefaultTestExecutionListenerClassNames信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]十一月 12, 2016 7:59:21 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper instantiateListeners信息: Could not instantiate TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener]. Specify custom listener classes or make the default listener classes (and their required dependencies) available. Offending class: [javax/servlet/ServletContext]十一月 12, 2016 7:59:21 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners信息: Using TestExecutionListeners: [org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@1be98f5, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1adae5d, org.springframework.test.context.support.DirtiesContextTestExecutionListener@17f6480, org.springframework.test.context.transaction.TransactionalTestExecutionListener@16e8792, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@12cbfa]十一月 12, 2016 7:59:21 下午 org.springframework.context.support.GenericApplicationContext prepareRefresh信息: Refreshing org.springframework.context.support.GenericApplicationContext@1560810: startup date [Sat Nov 12 19:59:21 CST 2016]; root of context hierarchyActive profile := devtest := trueAround method:description!Hello World!Before method:description!I'm car's steer!Is game over?!After method:description!AfterReturning method:description!Around method:description!Hello World!Before method:description!I'm car's wheels!Is game over?!After method:description!AfterReturning method:description!Around method:description!Hello World!Before method:description!I'm car's engine!Is game over?!After method:description!AfterReturning method:description!十一月 12, 2016 7:59:22 下午 org.springframework.context.support.GenericApplicationContext doClose信息: Closing org.springframework.context.support.GenericApplicationContext@1560810: startup date [Sat Nov 12 19:59:21 CST 2016]; root of context hierarchy
0 0
- Spring 全注解配置 bean 和 调用 (9) 5种通知
- Spring 全注解配置 bean 和 调用 (1)
- Spring 全注解配置 bean 和 调用 (5) @Qualifier 自动装配歧义性消除
- Spring 全注解配置 bean 和 调用 (3) @Conditonal 条件化的配置bean
- Spring 全注解配置 bean 和 调用 (6) 自定义注解 自动装配歧义性消除
- Spring 全注解配置 bean 和 调用 (2) @Profile 自适应不同的模式或环境中
- Spring 全注解配置 bean 和 调用 (4) @Primary 自动装配歧义性
- Spring 全注解配置 bean 和 调用 (7) properties文件注入
- Spring 全注解配置 bean 和 调用 (8) @Aspect注解不生效解决办法 和 no-static 的警告解决办法
- Spring -- 注解配置Bean
- spring 注解配置bean
- Spring - 注解配置Bean
- spring注解配置bean和注解配置aop
- Spring Bean配置:注解配置
- servlet调用spring容器中的bean,的两种方式一种注解一种xml配置
- servlet调用spring容器中的bean,的两种方式一种注解一种xml配置
- servlet调用spring容器中的bean,的两种方式一种注解一种xml配置
- spring 注解方式配置Bean
- 1112 练习 系统调用
- 爬虫资源
- 如何测试电脑的大小端存储
- GStreamer基础教程14——常用的element
- nginx windows应用配置
- Spring 全注解配置 bean 和 调用 (9) 5种通知
- python中tushare的安装--win7
- Android视频媒体相关,VideoView和开源框架vitamio
- 11.12
- python爬虫学习(下)——爬虫代码实现
- noip2014寻找道路
- pid_t的类型
- JAVA WEB中利用@responsebody返回json
- 1062. Talent and Virtue