AOP 注解问题
package com.chuanghe.web.utils;
import javax.xml.rpc.ServiceException;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class ReimDvisor {
@Pointcut("execution (* com.chuanghe.web.action.reim.ReimManageAction.doStampRecord(..))")
public void recordAction() {
System.out.print("===========");
}
@AfterReturning("recordAction()")
public void test(){
System.out.print("----------------");
}
}
spring 配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:component-scan base-package="com.chuanghe" />
<aop:aspectj-autoproxy/>
........省略
不知道怎么回事 打印不出来
import javax.xml.rpc.ServiceException;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class ReimDvisor {
@Pointcut("execution (* com.chuanghe.web.action.reim.ReimManageAction.doStampRecord(..))")
public void recordAction() {
System.out.print("===========");
}
@AfterReturning("recordAction()")
public void test(){
System.out.print("----------------");
}
}
spring 配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:component-scan base-package="com.chuanghe" />
<aop:aspectj-autoproxy/>
........省略
不知道怎么回事 打印不出来
...全文
相关推荐
Spring Boot中自定义注解结合AOP实现主备库切换问题
本文将详细介绍如何使用自定义注解结合 AOP 实现主备库切换问题。1. 自定义注解自定义注解是 Spring Boot 中的一种非常重要的机制,用于标记方法或类,实现一些特殊的逻辑。
Spring框架AOP注解配置不生效问题排查与解决
资源下载链接为:https://pan.quark.cn/s/67c535f75d4cSpring AOP 失效排查与应对先确认切面是否真正启用XML:在配置文件中同时出现 <aop:aspect>
Spring aop失效的几种解决方案
描述解释该文档主要介绍了Spring AOP失效的几种解决方案,通过示例代码对问题进行了详细的描述,对读者的学习或工作具有参考价值。
aop编程jar包
如果这个库出现问题,Spring可能无法找到或处理切面注解,进而导致AOP功能失效。5.
Spring AOP + 注解实现统一注解功能
日志记录是系统中非常重要的一部分,通过日志记录我们可以了解系统的运行情况,以及出现问题时的 troublshooting。2.



