03 2014 档案

摘要:通过Spring自定义event首先我们定义我们的event类package com.hyenas.spring.custom.event;import org.springframework.context.ApplicationEvent;public class CustomEvent extends ApplicationEvent{ private static final long serialVersionUID = -82737763905791865L; public CustomEvent(Object source) { super(so... 阅读全文
posted @ 2014-03-27 21:52 纵酒挥刀斩人头 阅读(581) 评论(0) 推荐(0)
摘要:Spring内置的event有1.ContextRefreshedEventThis event is published when theApplicationContextis either initialized or refreshed. This can also be raised using the refresh() method on theConfigurableApplicationContextinterface.2.ContextStartedEventThis event is published when theApplicationContextis start 阅读全文
posted @ 2014-03-27 20:22 纵酒挥刀斩人头 阅读(1302) 评论(0) 推荐(0)
摘要:利用spring,自己实现的一个观察者模式,写着玩玩,目的是为了加深理解,下次用Spring自带的玩一玩。首先我们定义一个侦听类接口package com.hyenas.common.listener;import java.util.Map;public interface Observer { public boolean isAsyn(); public void excute(Map params);}抽象侦听类package com.hyenas.common.listener;public abstract class AbstractObserver impl... 阅读全文
posted @ 2014-03-26 22:25 纵酒挥刀斩人头 阅读(907) 评论(0) 推荐(0)
摘要:Query query = new Query(); Criteria criteria = Criteria.where("timestamp").gt(from).lt(to); query.addCriteria(criteria); query.with(new Sort(Direction.ASC, "timestamp")); query.limit(limit); 阅读全文
posted @ 2014-03-25 20:05 纵酒挥刀斩人头 阅读(545) 评论(0) 推荐(0)