{"action":"created","issue":{"url":"https://api.github.com/repos/nutzam/nutz/issues/1133","repository_url":"https://api.github.com/repos/nutzam/nutz","labels_url":"https://api.github.com/repos/nutzam/nutz/issues/1133/labels{/name}","comments_url":"https://api.github.com/repos/nutzam/nutz/issues/1133/comments","events_url":"https://api.github.com/repos/nutzam/nutz/issues/1133/events","html_url":"https://github.com/nutzam/nutz/issues/1133","id":175950026,"number":1133,"title":"ioc注入的错误","user":{"login":"ansjsun","id":1221947,"avatar_url":"https://avatars.githubusercontent.com/u/1221947?v=3","gravatar_id":"","url":"https://api.github.com/users/ansjsun","html_url":"https://github.com/ansjsun","followers_url":"https://api.github.com/users/ansjsun/followers","following_url":"https://api.github.com/users/ansjsun/following{/other_user}","gists_url":"https://api.github.com/users/ansjsun/gists{/gist_id}","starred_url":"https://api.github.com/users/ansjsun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansjsun/subscriptions","organizations_url":"https://api.github.com/users/ansjsun/orgs","repos_url":"https://api.github.com/users/ansjsun/repos","events_url":"https://api.github.com/users/ansjsun/events{/privacy}","received_events_url":"https://api.github.com/users/ansjsun/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-09T07:58:23Z","updated_at":"2016-09-09T08:25:41Z","closed_at":"2016-09-09T08:25:41Z","body":"版本\r\n\r\nnutz-1.r.57.r3.jar\r\nmongo-java-driver-3.2.2.jar\r\nnutzmongo-1.r.57-20160602.132719-1.jar\r\n\r\nIoc.js\r\n````\r\nvar ioc = {\r\n\tzMongo : {\r\n\t\ttype : \"org.nutz.mongo.ZMongo\" ,\r\n\t\targs : [ \"xxxx\", 27017 ], // 或者不写参数，默认就是127.0.0.1和27017\r\n\t\tfactory : \"org.nutz.mongo.ZMongo#me\"\r\n\t},\r\n\tzMoDB : {\r\n\t\targs : [ \"xxx_mobile\" ], // 数据库名称\r\n\t\tfactory : \"$zMongo#db\"\r\n\t},\r\n\tzMoCoUser : {\r\n\t\targs : [ \"user\" ],\r\n\t\tfactory : \"$zMoDB#c\"\r\n\t},\r\n\tzMoCoMessage : {\r\n\t\targs : [ \"message\" ],\r\n\t\tfactory : \"$zMoDB#c\"\r\n\t}\r\n\t\r\n};\r\n\r\n````\r\n\r\n\r\ncode\r\n\r\n````\r\nIoc ioc = new NutIoc(new JsonLoader(\"src/test/resources/ioc.js\"));\r\n\t\t\r\n\t\t\r\n\t\tZMoCo zMoCoUser = ioc.get(ZMoCo.class,\"zMoCoUser\")  ;\r\n\r\n\t\tSystem.out.println(zMoCoUser);\r\n````\r\n\r\nerror\r\n\r\n````\r\nlog4j:WARN No appenders could be found for logger (org.nutz.resource.Scans).\r\nlog4j:WARN Please initialize the log4j system properly.\r\nlog4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.\r\nException in thread \"main\" org.nutz.ioc.IocException: [zMoCoUser, zMoDB] # NULL TYPE object 'zMoDB'\r\n\tat org.nutz.ioc.impl.NutIoc.get(NutIoc.java:199)\r\n\tat org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)\r\n\tat org.nutz.ioc.impl.ObjectMakerImpl$1.born(ObjectMakerImpl.java:88)\r\n\tat org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:67)\r\n\tat org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:114)\r\n\tat org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)\r\n\tat org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)\r\n\tat cn.com.infcn.mobile.UserApi.main(UserApi.java:29\r\n````\r\n\r\n\r\n如果这么写\r\n\r\n````\r\npublic static void main(String[] args) {\r\n\t\t\r\n\t\tIoc ioc = new NutIoc(new JsonLoader(\"src/test/resources/ioc.js\"));\r\n\t\t\r\n\t\tZMongo zMongo = ioc.get(ZMongo.class,\"zMongo\") ;\r\n\t\t\r\n\t\tZMoDB zMoDB = ioc.get(ZMoDB.class,\"zMoDB\")  ;\r\n\t\t\r\n\t\tZMoCo zMoCoUser = ioc.get(ZMoCo.class,\"zMoCoUser\")  ;\r\n\r\n\t\tSystem.out.println(zMoCoUser);\r\n\r\n\t}\r\n````\r\n\r\n就不报错"},"comment":{"url":"https://api.github.com/repos/nutzam/nutz/issues/comments/245851360","html_url":"https://github.com/nutzam/nutz/issues/1133#issuecomment-245851360","issue_url":"https://api.github.com/repos/nutzam/nutz/issues/1133","id":245851360,"user":{"login":"wendal","id":589819,"avatar_url":"https://avatars.githubusercontent.com/u/589819?v=3","gravatar_id":"","url":"https://api.github.com/users/wendal","html_url":"https://github.com/wendal","followers_url":"https://api.github.com/users/wendal/followers","following_url":"https://api.github.com/users/wendal/following{/other_user}","gists_url":"https://api.github.com/users/wendal/gists{/gist_id}","starred_url":"https://api.github.com/users/wendal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wendal/subscriptions","organizations_url":"https://api.github.com/users/wendal/orgs","repos_url":"https://api.github.com/users/wendal/repos","events_url":"https://api.github.com/users/wendal/events{/privacy}","received_events_url":"https://api.github.com/users/wendal/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T08:25:41Z","updated_at":"2016-09-09T08:25:41Z","body":"fix in a591197cd445ceee07cd695def7fd960b5baaa92\r\n\r\n已经改好了的, 老版本依然需要声明type."}}
{"actor":{"display_login":"wendal"}}