[英]Spring AOP - Pointcut Not working
我創建了一個切入點。 但這是行不通的。 請協助我處理以下代碼。 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring- aop-3.0.xsd “>
<aop:aspectj-autoproxy />
<bean id="customerBo" class="com.mkyong.customer.bo.impl.CustomerBoImpl" />
<!-- Aspect -->
<bean id="logAspect" class="com.mkyong.aspect.LoggingAspect" />
將方面bean XML配置為LoggingAspect
,然后將您的方面類MyAspect
嗎?
我認為您的問題出在切入點定義中。 你用
@Pointcut("within(com.mkyong.customer.bo.*)")
public void checkMyDetails() {}
但要在包及其所有子包中定義切入點(在您的情況下為實現包),則語法為
@Pointcut("within(com.mkyong.customer.bo..*)")
public void checkMyDetails() {}
請注意兩個點: bo..*
而不是bo.*
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.