aop:pointcut 求高手
会上树的熊 2016-09-23 04:58:26 别人想通过webservice接口调用我自己系统里面的数据,我在controller里面开了一个接口,但我在controller里面调用service.lxyAll()方法时要记入操作日志,但我想让这个方法不记录操作日志,就是不进入切点,AOP里面怎么配置?如下配置报错:
<aop:config>
<aop:pointcut id="transactionPointcut" expression="execution(* com.lxy.service..*Impl.*(..))" />
<aop:advisor pointcut-ref="transactionPointcut" advice-ref="transactionAdvice" />
</aop:config>
<aop:config>
<aop:pointcut id="logPointcut" expression="execution(* com.lxy.service..*Impl.*(..))and !execution(* lxyAll(..))" />
<aop:aspect ref="myAutoLogService">
<aop:around method="aroundLog" pointcut-ref="logPointcut" />
</aop:aspect>
</aop:config>
controller如下所示:
@Component
@Path("phone")
public class PhoneDataEndPoint {
private IVillageService villageService;
public IVillageService getVillageService() {
return villageService;
}
@Autowired
public void setVillageService(IVillageService villageService) {
this.villageService = villageService;
}
/*
* 获取小区信息。
* http://localhost:8080/idc/api/phone/listVillageInfo
*/
@GET
@Path("listVillageInfo")
@Produces(MediaType.APPLICATION_JSON)
public List<TpVillage> listVillageInfo(@QueryParam("s") String s) {
if(s.equals("xiaoqu")){
List<TpVillage> vill=null;
try {
vill=villageService.lxyAll();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return vill;
}else
return null;
}
}
求高手指点