import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class ExceptionAlerts {
public ExceptionAlerts() {
System.err.println("Class Scanned");
}
@AfterThrowing(pointcut = "com.name.papp.star", throwing = "ex")
public void doRecoveryAction(Throwable ex) throws Throwable {
System.err.println(">>>>>>>>>>>>>>>>Recovery Actions++++++++++++++++");
}
}
服务界面
public interface SignInService {
CustomerSignInDTO signIn()
throws LappException;
}
服务实现类
public class SignInServiceImpl implements SignInService {
@Override
@Transactional(readOnly = false, rollbackFor = Exception.class)
public CustomerSignInDTO signInCustomer(CustomerDeviceDTO customerDeviceDTO,
String mobileNumber, boolean createIfNotExist)
throws LappException {
// Throwing Exception Here
}
}
问题- 春季启动1.2.5
永远不会调用方法doRecoveryActions
。我还在某处使用@ExceptionHandler
来准备错误响应。是因为@ExceptionHandler
捕获了所有异常并且从未调用doRecoveryActions
吗?任何建议将不胜感激!