Spring 事件机制
2015-07-05 22:24
162 查看
通过模拟邮件的发送,说明Spring的事件监听机制
事件类
D:\GitHub\tools\JavaEEDevelop\Lesson17_JavaWebDemo\test\org\zln\module_chapter2\event\MailSenderTest.java
事件类
package org.zln.module_chapter2.event; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import static org.junit.Assert.*; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"/org/zln/cfg/spring/applicationContext.xml"})/*启动Spring容器*/ public class MailSenderTest { @Autowired @Qualifier("mailSender") private MailSender mailSender; @Test public void testSetApplicationContext() throws Exception { } @Test public void testSendMail() throws Exception { mailSender.sendMail("nbzlnzlq@126.com"); } }
D:\GitHub\tools\JavaEEDevelop\Lesson17_JavaWebDemo\test\org\zln\module_chapter2\event\MailSenderTest.java
相关文章推荐
- Java Calendar实现控制台日历
- JAVA中的反射机制
- java之yield(),sleep(),wait()等区别
- Java程序日志二
- [LeetCode][Java] Median of Two Sorted Arrays
- javaSE学习笔记之IO
- Thinking in Java 笔记1-11
- spring各种邮件发送
- JavaEE
- java引用数据类型的排序总结(内置类,自定义类,容器类)
- [LeetCode][Java] Longest Substring Without Repeating Characters
- JAVA面向对象第二天
- Java核心技术I——基础点拾掇(第六章)
- Java - Thinking in Java 第2章 一切都是对象
- scala eclipse plugin 插件安装
- 你应该更新的 Java 知识之常用程序库【转载】
- JAVA面向对象第一天
- Spring Mvc+ajax发送请求参数接收问题
- JAVA-反射-getGenericSuperclass()介绍
- Java程序设计日志一