0

「aop:aspectj-autoproxy」と「mvc:annotation-driven」の両方が XML 構成に存在します。これらのクラスは両方とも、同じ XML 内で Bean として定義されています。

ローカル/開発環境で Spring 3.2.3.RELEASE と Google App Engine 1.8.1 を使用する。

ポイントカットが実行されません。

私のアドバイス。@Aspect で注釈が付けられたクラス内で宣言されます。

@Component
@Aspect
public class RequestLimiter {
    private MemcacheService cache = MemcacheServiceFactory.getMemcacheService();

@Pointcut("within(@pcs.annotations.LimitRequests com.zdware.pcs.controllers.PingCollectorController)")
public void methodRequestLimited(){}

 @Around("methodRequestLimited() && args(req,limitRequests)")
     public Object requestGateWay(ProceedingJoinPoint jp, HttpServletRequest req,LimitRequests limitRequests) throws Throwable {

     // do stuff

    }
}

コントローラーレイヤーでテストするために使用している方法。

@Controller
public class PingCollectorController {
@RequestMapping(value="/test")
@LimitRequests(requestTimeLimit = 1, functionName = "Test")
public String test(){
    return "test"; // this will return me to a jsp that doesnt exist, but my advice is still not executing.
}
 }
4

1 に答える 1

2

CGLIB はクラスパスにありますか? プロキシを生成する必要があります (コントローラーはインターフェイスを実装していないため、Spring はより単純な JDK プロキシを使用できません)。

于 2013-07-02T03:11:33.033 に答える