2011-11-28 4 views
2

에 조인 포인트를 사용하여 포인트 컷은 메소드 이름이 삽입되거나 메소드 이름이 업데이트입니다 또는 메소드 이름 인 경우 적용 할 수있다 삭제 방법은해야 정확히 세 개의 인수 이것은 내가 쓴 코드이었다조건은 우리가 내 요구 사항에 <p>봄</p>에 포인트를 가입 조건 어떻게 사용합니까 봄

,

<aop:config> 
    <aop:aspect ref="auditAOP"> 
     <aop:pointcut id="insert" expression="execution(* .IbatisDAOSupportImpl.insert(*,*,*))" /> 
     <aop:pointcut id="delete" expression="execution(* IbatisDAOSupportImpl.delete(*,*,*))" /> 
     <aop:pointcut id="update" expression="execution(* IbatisDAOSupportImpl.update(*,*,*))" /> 
     <aop:pointcut id="auditInsertUpdateOrDelete" expression="insert || delete || update"/> 
     <aop:after method="afterInsertUpdateOrDelete" pointcut-ref="auditInsertUpdateOrDelete"/> 
    </aop:aspect> 

</aop:config> 

아래 라인에 문제가 있습니다; 표현이 잘 형성되어 있지 않다는 오류가 나타납니다.

<aop:pointcut id="auditInsertUpdateOrDelete" expression="insert || delete || update"/> 

답변

1

단일 논리식의 모든 논리를 포함하는 복잡한 포인트 컷이 필요합니다. 표현식에서 다른 pointcut을 참조하려고하는데, 그냥 작동하지 않습니다. http://forum.springsource.org/showthread.php?37596-complex-pointcut-expressions

: 여기
<aop:config> 
    <aop:aspect ref="auditAOP"> 
    <aop:pointcut id="auditInsertUpdateOrDelete" expression="within(*.IbatisDAOSupportImpl) 
        and (execution(* insert*(..)) or 
        execution(* delete*(..)) or 
        execution(* update*(..)))"/> 
    <aop:after method="afterInsertUpdateOrDelete" pointcut-ref="auditInsertUpdateOrDelete"/> 
    </aop:aspect> 
</aop:config> 

가 구축 복잡한 식에 대한 좋은 참조가 :

당신은 같은 것을 할 필요가