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

spring AOP诠释技巧-使用&&和

2012-08-31 
spring AOP注释技巧-使用&&和!?import org.apache.commons.logging.Logimport org.apache.commons.loggin

spring AOP注释技巧-使用&&和!

?

import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.aspectj.lang.JoinPoint;import org.aspectj.lang.annotation.Aspect;import org.aspectj.lang.annotation.Before;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Component;import com.jsczxy2.exception.DwrException;import com.jsczxy2.web.dwr.BaseDwr;/** * @author jsczxy2 * DWR权限AOP */@Aspect@Componentpublic class DwrAspect {Log log = LogFactory.getLog(getClass());@Autowiredprivate BaseDwr baseDwr;@Before("execution(* com.jsczxy2.web.dwr..*.*(..)) && !execution(* com.jsczxy2.web.dwr.BaseDwr.*(..))")public void checkLogin(JoinPoint jp) throws Throwable{if(baseDwr.getRequest().getSession().getAttribute("user")==null){throw new DwrException("登录后才能进行操作");}}}

热点排行