本帖最后由 lalashuai666 于 2013-03-29 13:14:25 编辑

解决方案 »

  1.   

    有执行doStampRecord方法吗 ReimManageAction有配置注解吗
      

  2.   

    @Controller("/control/reim/manage")
    @Component("com/chuanghe/web/utils/ReimDvisor")
    public class ReimManageAction extends DispatchAction {
    现在报错Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.IllegalStateException: Stereotype annotations suggest inconsistent component names: '/control/reim/manage' versus 'com/chuanghe/web/utils/ReimDvisor'
      

  3.   

    改为<aop:aspectj-autoproxy proxy-target-class="false"/> 在原来的基础上
      

  4.   

    我重新发一下代码声明类
    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("----------------");
    }}目标类  
    package com.chuanghe.web.action.reim;import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;
    import java.io.PrintWriter;
    import java.text.DateFormat;
    import java.text.DecimalFormat;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.HashSet;
    import java.util.LinkedHashSet;
    import java.util.List;
    import java.util.Set;import javax.annotation.Resource;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;import net.sf.json.JSONArray;import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.actions.DispatchAction;
    import org.aspectj.lang.annotation.AfterReturning;
    import org.aspectj.lang.annotation.Pointcut;
    import org.springframework.context.annotation.Scope;
    import org.springframework.stereotype.Component;
    import org.springframework.stereotype.Controller;import com.chuanghe.Constant.ReimState;
    import com.chuanghe.Constant.Report;
    import com.chuanghe.Constant.ReturnUrl;
    import com.chuanghe.bean.common.Department;
    import com.chuanghe.bean.common.Employ;
    import com.chuanghe.bean.common.StampRecord;
    import com.chuanghe.bean.common.SystemOption;
    import com.chuanghe.bean.loan.LoanTab;
    import com.chuanghe.bean.project.Project;
    import com.chuanghe.bean.reim.CostType;
    import com.chuanghe.bean.reim.ReimHead;
    import com.chuanghe.bean.reim.ReimList;
    import com.chuanghe.bean.reim.ReportStream;
    import com.chuanghe.bean.reim.StatusPara;
    import com.chuanghe.service.common.DepartmentService;
    import com.chuanghe.service.project.ProjectService;
    import com.chuanghe.service.reim.CostTypeService;
    import com.chuanghe.service.reim.ReimHeadService;
    import com.chuanghe.service.reim.ReimListService;
    import com.chuanghe.service.reim.ReportStreamService;
    import com.chuanghe.service.stamprecord.StampRecordService;
    import com.chuanghe.utils.RandomByMD5;
    import com.chuanghe.utils.SiteUrl;
    import com.chuanghe.utils.WebUtil;
    import com.chuanghe.web.formbean.reim.ReimForm;
    import com.chuanghe.web.utils.Rights;
    import com.chuanghe.web.utils.SystemOptionInit;
    import com.oracle.xmlns.oxp.service.PublicReportService.ParamNameValue;
    import com.oracle.xmlns.oxp.service.PublicReportService.PublicReportService;
    import com.oracle.xmlns.oxp.service.PublicReportService.PublicReportServiceServiceLocator;
    import com.oracle.xmlns.oxp.service.PublicReportService.ReportRequest;
    import com.oracle.xmlns.oxp.service.PublicReportService.ReportResponse;/**
     * @author zhangteng
     *
     */
    @Scope("prototype")
    @Controller("/control/reim/manage")
    @Component("com/chuanghe/web/utils/ReimDvisor")
    public class ReimManageAction extends DispatchAction {
    .......省略
    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">                          
    <aop:aspectj-autoproxy proxy-target-class="false"/>
    <context:component-scan base-package="com.chuanghe" />  
                 。。省略报错
    Unexpected exception parsing XML document from class path resource [applicationContext.xml]; nested exception is java.lang.IllegalStateException: Stereotype annotations suggest inconsistent component names: '/control/reim/manage' versus 'com/chuanghe/web/utils/ReimDvisor'
      

  5.   

    @Controller
    @Component
    不要加东西。
      

  6.   

    @Component 后面删了package com.chuanghe.web.action.reim;@Scope("prototype")
    @Controller("/control/reim/manage")
    @Component
    public class ReimManageAction extends DispatchAction {
    不报错了...但是 @Component
    @Aspect
    public class ReimDvisor {

    @Pointcut("execution (* com.chuanghe.web.action.reim.ReimManageAction.doStampRecord(..))")
     public void helloworld() {  
    System.out.println("throw runtime exception");  
     }  

     @AfterThrowing(pointcut="helloworld()",throwing="e")  
     public void exceptionSayHello(Exception e) {  
      System.out.println("throw runtime exception"+e);  
     }   }  
    没有执行  没有输出
      

  7.   

    http://blog.sina.com.cn/s/blog_7d2dd23c0100unak.html
    看看这个例子,和你几乎是一样的。
      

  8.   

    好像是@Controller("/control/reim/manage")  这个东西 自动注入  和那个切面需要的bean有冲突  我感觉报错好像是和@Controller("/control/reim/manage")有关