我需要創造,我覺得很難形容一個方面,所以讓我指出的觀點:Spring AOP的切入點與一個特定的參數
- COM的包(或任何一個子包)中的任何方法。 XY ..
- 一個方法的參數是一個接口的實現javax.portlet.PortletRequest
- 有可能在方法我更多的參數
- 他們可能會以任意順序
我需要一個切入點,並給出
目前的PortletRequest的 「繞」 的建議,我有SMT,如:
@Pointcut("execution(* com.x.y..*.*(PortletRequest,..)) && args(request,..)")
public void thePointcut(PortletRequest request) {
}
@Around("thePointcut(request)")
public Object theAdvice(ProceedingJoinPoint joinPoint, PortletRequest request) {
...
,並收到一個錯誤:
ERROR 10:47:27.159 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] o.s.web.portlet.DispatcherPortlet - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet. mvc.HttpRequestHandlerAdapter': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: w arning no match for this type name: PortletRequest [Xlint:invalidAbsoluteTypeName]
任何幫助,高度讚賞
親切的問候, 丹
UPDATE 我試圖攔截的方法是:
在公共類com.xyMainClass:
public String mainRender(Model model, RenderRequest request) throws SystemException
在公共類com.xyasd.HelpClass :
public final void helpAction(ActionRequest request, ActionResponse response, Model model)
對於cource,我想獲得實現PortletRequest的參數,即第一個方法中的RenderRequest和第二個中的ActionRequest。
問候, 丹
我不再接受錯誤,但切入點並沒有捕獲該方法。 更具體一點,請查看上面更新的帖子。 – Queequeg
這兩種方法或只有mainRender方法。您定義點刪除的方式只會匹配第一個參數爲PortletRequest的那些方法。你可以嘗試類似args(..,request,..) - 不知道這是否可行。您還可以重新排序參數,以使PortletRequest成爲第一個參數。 – gkamal
我想捕捉參數之間的PortletRequest的任何方法,並有權訪問該請求。 – Queequeg