我想使用以下代码检查在Spring MVC中是基于本地还是服务器发送电子邮件,这可能吗?
@Before("execution(public * org.springframework.mail.javamail.JavaMailSenderImpl.send(..))")
public void checkIfSendEmail(JoinPoint joinPoint) throws MailException {
String appName = preferences.getStringValue("GENERAL","APPLICATION-NAME");
if (!appName.toUpperCase().contains("DEV")) {
joinPoint.getSignature().getName();
}
else {
System.out.println("Not send email on local.");
}
}