@Test public void testMailSender() { MailSender mailSender = (MailSender)ctx.getBean("mailSender"); mailSender.sendMail("aaa@bbb.com"); }
public void sendMail(String to){ System.out.println("MailSender:模拟发送邮件..."); MailSendEvent mse = new MailSendEvent(this.ctx,to); ctx.publishEvent(mse); }
MailSender implements ApplicationContextAware { public void sendMail(String to){ System.out.println("MailSender:模拟发送邮件..."); MailSendEvent mse = new MailSendEvent(this.ctx,to); ctx.publishEvent(mse); } }
MailSender implements ApplicationContextAware { public void sendMail(String to){ System.out.println("MailSender:模拟发送邮件..."); MailSendEvent mse = new MailSendEvent(this.ctx,to); ctx.publishEvent(mse); }  }
MailSender implements ApplicationContextAware { public void sendMail(String to){ System.out.println("MailSender:模拟发送邮件..."); MailSendEvent mse = new MailSendEvent(this.ctx,to); ctx.publishEvent(mse); }  void setApplicationContext(ApplicationContext ctx); void sendMail(String to); }
MailSender implements ApplicationContextAware { public void sendMail(String to){ System.out.println("MailSender:模拟发送邮件..."); MailSendEvent mse = new MailSendEvent(this.ctx,to); ctx.publishEvent(mse); }  void setApplicationContext(ApplicationContext ctx); void sendMail(String to);  }