log4j: 2012-02-2723:19:38,366 [main] WARN org.nutz.ioc.IocLoading - Using *Declared* ioc-define (without type or events)!!! Pls use Standard Ioc-Define!! Bean will define as: { "singleton" :true, "args" :[], "fields" :[{ "name" :"name", "value" :{ "type" :"normal", "value" :"XiaoBai" } }, { "name" :"birthday", "value" :{ "type" :"normal", "value" :"2009-10-25 15:23:40" } }] }
警告的意思是“使用了声明式的ioc定义,请使用标准的ioc定义”,那么什么是标准的ioc定义呢,Hello world 的下一节匿名对象就说了:如果配置文件解析成map后的键值仅包含“type、scope、singleton、fields、args、events”中的一个或几个字段,就是个标准的ioc定义。
@SuppressWarnings("unchecked") public IocObject map2iobj(Map map)throws ObjectLoadException { final IocObject iobj = new IocObject(); if (!isIocObject(map)) { for (Entry en : map.entrySet()) { IocField ifld = new IocField(); ifld.setName(en.getKey()); ifld.setValue(object2value(en.getValue())); iobj.addField(ifld); } if(log.isWarnEnabled()) //TODO 移除这种兼容性 log.warn("Using *Declared* ioc-define (without type or events)!!! Pls use Standard Ioc-Define!!" + " Bean will define as:\n"+Json.toJson(iobj)); }// 此处省略其他代码 }