{"action":"created","issue":{"url":"https://api.github.com/repos/ninjaframework/ninja/issues/447","labels_url":"https://api.github.com/repos/ninjaframework/ninja/issues/447/labels{/name}","comments_url":"https://api.github.com/repos/ninjaframework/ninja/issues/447/comments","events_url":"https://api.github.com/repos/ninjaframework/ninja/issues/447/events","html_url":"https://github.com/ninjaframework/ninja/pull/447","id":127607098,"number":447,"title":"freemarker support custom template model","user":{"login":"huwei","id":328591,"avatar_url":"https://avatars.githubusercontent.com/u/328591?v=3","gravatar_id":"","url":"https://api.github.com/users/huwei","html_url":"https://github.com/huwei","followers_url":"https://api.github.com/users/huwei/followers","following_url":"https://api.github.com/users/huwei/following{/other_user}","gists_url":"https://api.github.com/users/huwei/gists{/gist_id}","starred_url":"https://api.github.com/users/huwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huwei/subscriptions","organizations_url":"https://api.github.com/users/huwei/orgs","repos_url":"https://api.github.com/users/huwei/repos","events_url":"https://api.github.com/users/huwei/events{/privacy}","received_events_url":"https://api.github.com/users/huwei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-01-20T05:22:27Z","updated_at":"2016-01-28T13:42:22Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ninjaframework/ninja/pulls/447","html_url":"https://github.com/ninjaframework/ninja/pull/447","diff_url":"https://github.com/ninjaframework/ninja/pull/447.diff","patch_url":"https://github.com/ninjaframework/ninja/pull/447.patch"},"body":"for example:\r\n```\r\npublic class NinjaExtModule extends AbstractModule {\r\n\r\n    protected void configure() {\r\n        MapBinder<String, TemplateModel> mapbinder\r\n                = MapBinder.newMapBinder(binder(), String.class, TemplateModel.class);\r\n        mapbinder.addBinding(\"xsrfToken\").to(TemplateEngineFreemarkerXsrfTokenDirective.class);\r\n        mapbinder.addBinding(\"xsrfForm\").to(TemplateEngineFreemarkerXsrfFormDirective.class);\r\n    }\r\n\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/ninjaframework/ninja/issues/comments/176189765","html_url":"https://github.com/ninjaframework/ninja/pull/447#issuecomment-176189765","issue_url":"https://api.github.com/repos/ninjaframework/ninja/issues/447","id":176189765,"user":{"login":"raphaelbauer","id":524072,"avatar_url":"https://avatars.githubusercontent.com/u/524072?v=3","gravatar_id":"","url":"https://api.github.com/users/raphaelbauer","html_url":"https://github.com/raphaelbauer","followers_url":"https://api.github.com/users/raphaelbauer/followers","following_url":"https://api.github.com/users/raphaelbauer/following{/other_user}","gists_url":"https://api.github.com/users/raphaelbauer/gists{/gist_id}","starred_url":"https://api.github.com/users/raphaelbauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raphaelbauer/subscriptions","organizations_url":"https://api.github.com/users/raphaelbauer/orgs","repos_url":"https://api.github.com/users/raphaelbauer/repos","events_url":"https://api.github.com/users/raphaelbauer/events{/privacy}","received_events_url":"https://api.github.com/users/raphaelbauer/received_events","type":"User","site_admin":false},"created_at":"2016-01-28T13:42:22Z","updated_at":"2016-01-28T13:42:22Z","body":"Ok. The \"solution\" to the problem: Guice has to know that there is a Set<TemplateEngineModels> that will be injected somewhere. Otherwise it complains. Therefore we have to call the multibinder at least once in the modules that create the injector.\r\n\r\nThat means we have to add something like\r\n\r\n    Multibinder.newSetBinder(binder(), TemplateEngineFreemarkerModel.class);\r\n\r\nin Ninja's Configuration.java. But also in all tests that use an injector but don't use Configuration.java as basis (eg TemplateEngineManagerImplTest).\r\n\r\nThen it works for me nicely. Can you confirm that?\r\n"}}