Я пытаюсь добавить уже работающую аннотацию AOP вокруг нового метода в классе, где он уже размещен. Он не работает для нового метода, который я определил в качестве метода по умолчанию для интерфейса (не работает, даже если не переопределен), и я не могу найти причину этого. Код:
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface PaymentPlanLocking {}
@Aspect
@Component
public class PaymentPlanLockAspect
{
..
@Around("@annotation(PaymentPlanLocking)")
public Object paymentPlanLocking(ProceedingJoinPoint joinPoint) throws Throwable
{
..
public interface PaymentOrchestratorService<RQ, RS>
{
/**
* @param request to validate
*/
void validate(RQ request) throws PaymentServiceException;
/**
* @param request to execute
* @return response
*/
RS execute(RQ request) throws PaymentServiceException;
/**
* @param request to execute
* @return response
*/
default RS doExecute(RQ request) throws PaymentServiceException{
throw new RuntimeException("please override this method in subclass if using old model with execute-wrapped");
}
}
@Service("holdPaymentService")
public class HoldPaymentOrchestrationService extends AbstractService<HoldResponse, HoldRequest>
implements PaymentOrchestratorService<HoldRequest, HoldResponse>
{
...
@PaymentPlanLocking
@Override
public HoldResponse execute(HoldRequest holdRequest) throws PaymentServiceException
@PaymentPlanLocking
@Override
public HoldResponse doExecute(HoldRequest holdRequest) throws PaymentServiceException
Перехват работает для execute (HoldRequest holdRequest) , но не для doExecute (HoldRequest holdRequest) . Пожалуйста, помогите мне исправить это.