### Question:
EmailService implements ApplicationEventPublisherAware { public void sendEmail(String address, String text) { if (blackList.contains(address)) { BlackListEvent event = new BlackListEvent(this, address, text); publisher.publishEvent(event); return; } System.out.println("send email..."); System.out.println("email address : " + address + ", text: " + text); } EmailService(); void setBlackList(List<String> blackList); @Override void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher); void sendEmail(String address, String text);  }### Answer:
@Test public void testCustomEvent() throws Exception { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-event.xml"); EmailService emailService = context.getBean(EmailService.class); emailService.sendEmail("john.doe@example.org", "hands up, shit..."); }