Java 建议spring mvc http消息转换器
我试图建议SpringHTTP消息转换器,但是,我无法让它工作Java 建议spring mvc http消息转换器,java,spring,aop,aspectj,spring-aop,Java,Spring,Aop,Aspectj,Spring Aop,我试图建议SpringHTTP消息转换器,但是,我无法让它工作 @Pointcut("within(org.springframework.http.converter.xml.MarshallingHttpMessageConverter)") public void converterPointcut() { } @Pointcut("execution(* *(..))") public void converterMethodPointcut() { } @Around("conve
@Pointcut("within(org.springframework.http.converter.xml.MarshallingHttpMessageConverter)")
public void converterPointcut() {
}
@Pointcut("execution(* *(..))")
public void converterMethodPointcut() {
}
@Around("converterPointcut() && converterMethodPointcut()")
public Object aroundConverter(ProceedingJoinPoint iJoinPoint) {
Object aProceed = null;
try {
aProceed = iJoinPoint.proceed();
} catch (Throwable anException) {
anException.printStackTrace();
}
return aProceed;
}
这里有什么问题吗?a)使用中的,您只是建议封送HttpMessageConverter
类的方法,您确定这是您想要的吗
b) 要编织一个库类,您需要或者通过aspectj编译器运行SpringJAR(哎哟,不要这样做)。您是否设置了装载时间编织
c) 定义无法让它工作:发生了什么,没有发生什么
更新:我认为您试图解决错误的问题。不要使用AspectJ,只扩展类()和a)是的,我只想建议该类的方法,b)我没有设置加载时编织,我使用的是
,c)从未调用过Converter()方法。@outvir AspectJ autoproxy适用于您自己的代码,但您正在尝试向现有二进制代码添加建议。您需要加载时间编织