เพื่อวัตถุประสงค์ในการบันทึก เรากำลังพยายามตรวจจับข้อยกเว้นรันไทม์ของ Spring ต่างๆ ผ่านทาง AOP ของ Spring เอง และฉันต้องบอกว่าฉันไม่ประสบความสำเร็จ ดังนั้น ฉันจะขอบคุณสำหรับแนวคิดใดๆ เกี่ยวกับวิธีการแก้ไขปัญหานี้
ฉันได้ลองสิ่งนี้:
@Aspect
@Component
public class SomeAspect {
@AfterThrowing(pointcut = "execution(* org.springframwork.oxm..*(..))", throwing = "exception")
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED)
public void adviseSpringErrorEvents(JoinPoint joinPoint, final UnmarshallingFailureException exception) throws Throwable {
LOG.debug(this.getClass().getSimpleName() + " - Error message advice fired on method: " + joinPoint.getSignature().getName());
}
}
คลาสเป็นแบบ autoproxied และคำแนะนำที่เหลือในคลาสแง่มุมจะเริ่มทำงานอย่างถูกต้อง ดังนั้นจึงต้องมีปัญหากับนิพจน์ AspectJ
อัปเดต: รหัสภายในวิธีการไม่ทำงานและไม่ได้ตั้งใจที่จะจับข้อยกเว้นในคำแนะนำ
มีความคิดอะไรบ้าง? ขอบคุณล่วงหน้า
ป.ล. เวอร์ชัน Spring Framework คือ 3.0.6