摘要:
public static boolean nullSafeEquals(Object o1, Object o2) { //两个数据内存地址相等,或者为空 if (o1 == o2) { return true; } //有一个地址数据为空 if (o1 == null || o2 == null) { return false; } //都不会空 if (o1.equals(o2)) { return true; } //应用Arrays.equlas 方法实现 数组元数据的比较,漂亮 if (o1.ge... 阅读全文
posted @ 2014-02-18 09:30
cityboy509
阅读(1429)
评论(0)
推荐(0)
摘要:
Spring中有两种类型的Bean,一种是普通Bean,另一种是工厂Bean,即FactoryBean。工厂Bean跟普通Bean不同,其返回的对象不是指定类的一个实例,其返回的是该工厂Bean的getObject方法所返回的对象。在Spring框架内部,AOP相关的功能及事务处理中,很多地方使用到工厂Bean,本文简单分析工厂Bean的用法。首先回顾一下普通Bean,普通的Bean直接返回指定类(配置中的class属性的值)的一个实例,如下面的bean1将返回一个String字符串:下面,看看一个简单的工厂Bean:import java.util.Date;import org.sprin 阅读全文
posted @ 2014-02-12 11:49
cityboy509
阅读(191)
评论(0)
推荐(0)
摘要:
第一种解释:功能差不多,都用来进行线程控制,他们最大本质的区别是:sleep()不释放同步锁,wait()释放同步缩. 还有用法的上的不同是:sleep(milliseconds)可以用时间指定来使他自动醒过来,如果时间不到你只能调用interreput()来强行打断;wait()可以用notify()直接唤起.第二种解释:sleep是Thread类的静态方法。sleep的作用是让线程休眠制定的时间,在时间到达时恢复,也就是说sleep将在接到时间到达事件事恢复线程执行,例如:try{System.out.println("I'm going to bed");Th 阅读全文
posted @ 2014-02-12 09:36
cityboy509
阅读(164)
评论(0)
推荐(0)
摘要:
/** * Used to dereference a {@link FactoryBean} instance and distinguish it from * beans created by the FactoryBean. For example, if the bean named * myJndiObject is a FactoryBean, getting &myJndiObject * will return the factory, not the instance returned by the factory. */ String FACTORY_BEAN_. 阅读全文
posted @ 2014-02-12 09:35
cityboy509
阅读(263)
评论(0)
推荐(0)
浙公网安备 33010602011771号