解决方案 »
- 一个JS的问题
- 请教各位,考取个OCP,对以后转型有用吗?
- 方便对数据库进行备份、删除、恢复的框架???
- hibernate 分页 总是报错!
- ajax请求与struts请求
- 怎么解决MyEclipse + hibernate中的异常
- 急!!!! webshpere 刷新问题 和 务器日志在那里???????
- 要开发一个自来水收费系统,用什么技术比较好?解答则均有分
- 在线等待!
- There is no Action mapped for namespace [/] and action name [] associated with c
- jsp jquery路径问题
- javaEE开发时遇到连接数据库的问题,数据库是mysql
@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'
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'
@Component
不要加东西。
@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);
} }
没有执行 没有输出
看看这个例子,和你几乎是一样的。