package com.email.service.impl;
import com.email.service.EmailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
@Autowired
private EmailService emailService;
@ExceptionHandler(value = Exception.class)
public void handler(Exception e){
emailService.sendEmail("程序异常警告",e.toString());
}
}