`
angie_hawk7
  • 浏览: 46730 次
  • 性别: Icon_minigender_1
  • 来自: 乌托邦
社区版块
存档分类
最新评论
文章列表
1:使用私有构造函数强化singleton属性 实现singleton有两种方法,这两种方法都要把构造函数保持为私有,并且提供一个静态成员,以便允许客户能够访问该类唯一的实例 private static final SingletonTest instance = new SingletonTest(); private SingletonTest() { System.out.println("SingletonTest Constructor..."); } public static SingletonTest getI ...
先来看一个例子: 定义一个bean: public class Serial implements Serializable { int id; String name; public Serial(int id, String name) { this.id = id; this.name = name; } public String toString() { return "DATA: " + id + " " +name; } } 序列化操作: public static void mai ...
ApplicationEvent public abstract class ApplicationEvent extends EventObject ApplicationEventPublisher public interface ApplicationEventPublisher void publishEvent(ApplicationEvent event) 引用 Notify all listeners registered with this application of an application event. 引用Interface that encapsu ...
今天看到method injection这块,网上查了下,又了看了下reference,作个总结加备份吧算是,以下实例来自网络,可以运行 Lookup method injection使Spring克服当一个bean依赖其他不同生命周期的bean的情况,比如当一个单例bean依赖一个非单例对象的时候。在这种情况下,无论是使用setter注入还是constructor注入都只是在单例对象中维护一个非单例bean的一个单例(也就是一个相同的实例)。但是有些情况下,你将希望你的bean每次请求一个非单例bean的实例时都能够获得一个新的实例。 下面的例子中创建了两个单例bean和一个非单例bean; ...

户口啊,郁闷

很郁闷很郁闷很郁闷.....户口都一年了还没给我落下来,学位证毕业证,户口迁移证还都在集团,今天打电话过去,说没有我的资料.....真晕了,由于公司刚刚搬迁,我很是不安,我的这些证件不会给我弄丢了吧??很不安很不安,最后说可能还在档案室的大箱子里面,有时间了会去整理,帮我找找..... 都一年了,本来去年9月份就落下来,后来说我资料不齐,可也没通知我们啊,直到我有个同事要办理护照才直到他没办理下来,于是问我的户口状态....我一问集团,我的也没办下来..那会儿都年底了...没办理下来就通知我们啊,资料不全就通知一下啊...过完年一来就将资料补全,现在都半年过去了,催了好几次,结果我的资料还处于未 ...
主要是学习了解spring如何利用PropertyEditor完成conversion的。参考实现来自网络和spring reference Spring uses the concept of PropertyEditors to effect the conversion between an Object and a String. Spring has a number of built-in PropertyEditors to make life easy. Each of those is listed below and they are all located in the ...
1:The Resource interface 引用Spring's Resource interface is meant to be a more capable interface for abstracting access to low-level resources. public interface Resource extends InputStreamSource { boolean exists(); boolean isOpen(); URL getURL() throws IOException; File getFile() throws IOExcept ...
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"services.xml", "daos.xml"}); Using the method T getBean(Stringname, Class<T> requiredType) you can retrieve instances of your beans.// retrieve configured instance PetStoreServiceImpl service = ...
Global site tag (gtag.js) - Google Analytics