春の検証メソッドをオーバーライドした後に発生するすべてのエラーをキャプチャしようとしています。
以下のエラーが表示されます
Pointcut is not well-formed: expecting ')' at character position 135
前後に「)」を入れたり、削除したりするなど、多くの組み合わせを試しましたが、それでも同じエラーが発生します。私はSpringを学んでいるので、これがまさにaopを実装する方法であるかどうかはわかりません. どこが間違っているか教えてもらえますか、修正してもらえますか
これは、検証メソッドを実装するクラスです
package com.myapplication.validations
public class MyValidate implements Validator{{
public boolean supports(Class<?> clazz) {
return MyValidate.class.equals(clazz);
}
public void validate(Object target, MyApplicationErrors errors) {
//all validations
}
}
今、私の春のapplication-context.xmlで、次のaopを書きます
<aop:aspectj-autoproxy />
<bean id="captureErrors"
class="com.myapplication.aop.CaptureAllErrors" />
<aop:aspect ref="captureErrors">
<aop:pointcut id="magicallyCaptureErrors"
expression="execution(* com.myapplication.validations.MyValidate.validate(Object, com.myapplication.allerrors.MyApplicationErrors )) and args(Object target, com.myapplication.allerrors.MyApplicationErrors errors)" />
<aop:after-returning pointcut-ref="magicallyCaptureErrors" method="getAllErrors"/>
</aop:aspect>
</aop:config>
すべてのエラーをキャプチャするクラスは次のとおりです
package com.myapplication.aop
@Aspect
@Component
public class CaptureAllErrors {
public void getAllErrors(Object target, com.myapplication.allerrors.MyApplicationErrors errors){
log.info(errors.toString());
}
}