我需要创建一个我难以描述的方面,所以让我指出这些想法:
我需要一个切入点和给出的PortletRequest的"around"建议
目前我有点像:
@Pointcut("execution(* com.x.y..*.*(PortletRequest,..)) && args(request,..)")
public void thePointcut(PortletRequest request) {
}
@Around("thePointcut(request)")
public Object theAdvice(ProceedingJoinPoint joinPoint, PortletRequest request) {
...
Run Code Online (Sandbox Code Playgroud)
并收到错误:
错误10:47:27.159 [ContainerBackgroundProcessor [StandardEngine [Catalina]]] osweb.portlet.DispatcherPortlet - 上下文初始化失败org.springframework.beans.factory.BeanCreationException:创建名为'org.springframework.web.servlet的bean时出错.mvc.HttpRequestHandlerAdapter':bean的初始化失败; 嵌套异常是java.lang.IllegalArgumentException:w arning此类型名称不匹配:PortletRequest [Xlint:invalidAbsoluteTypeName]
任何帮助高度赞赏
亲切的问候,丹
更新 我试图拦截的方法是:
在公共类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.
问候,丹
gka*_*mal 11
由于错误建议您需要在切入点表达式中使用PortletRequest的完全限定名称 - 因为它是一个字符串,导致上下文在评估表达式时不可用.
@Pointcut("execution(* com.x.y..*.*(javax.portlet.PortletRequest.PortletRequest,..)) && args(request,..)")
public void thePointcut(PortletRequest request) {
}
Run Code Online (Sandbox Code Playgroud)
由于您已经在args构造中选择了类型,因此签名中不需要该类型.以下也应该有效.
@Pointcut("execution(* com.x.y..*.*(..)) && args(request,..)")
public void thePointcut(PortletRequest request) {
}
Run Code Online (Sandbox Code Playgroud)
它是一个布尔运算 - 也就是说,它需要匹配方法模式以及args构造.
| 归档时间: |
|
| 查看次数: |
15686 次 |
| 最近记录: |