首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

AOP 注解有关问题

2013-04-09 
AOP 注解问题本帖最后由 lalashuai666 于 2013-03-29 13:14:25 编辑package com.chuanghe.web.utilsimpor

AOP 注解问题
本帖最后由 lalashuai666 于 2013-03-29 13:14:25 编辑 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/> 

........省略
不知道怎么回事  打印不出来 aop spring
[解决办法]
@Controller
@Component
不要加东西。
[解决办法]
你在一个类中搞来搞去的。没有理解切面到底是干嘛用的

热点排行