{"action":"created","issue":{"url":"https://api.github.com/repos/ratpack/ratpack/issues/767","labels_url":"https://api.github.com/repos/ratpack/ratpack/issues/767/labels{/name}","comments_url":"https://api.github.com/repos/ratpack/ratpack/issues/767/comments","events_url":"https://api.github.com/repos/ratpack/ratpack/issues/767/events","html_url":"https://github.com/ratpack/ratpack/pull/767","id":103561298,"number":767,"title":"add the simplest support of custom Guice Injector factory","user":{"login":"phigoro","id":9573190,"avatar_url":"https://avatars.githubusercontent.com/u/9573190?v=3","gravatar_id":"","url":"https://api.github.com/users/phigoro","html_url":"https://github.com/phigoro","followers_url":"https://api.github.com/users/phigoro/followers","following_url":"https://api.github.com/users/phigoro/following{/other_user}","gists_url":"https://api.github.com/users/phigoro/gists{/gist_id}","starred_url":"https://api.github.com/users/phigoro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phigoro/subscriptions","organizations_url":"https://api.github.com/users/phigoro/orgs","repos_url":"https://api.github.com/users/phigoro/repos","events_url":"https://api.github.com/users/phigoro/events{/privacy}","received_events_url":"https://api.github.com/users/phigoro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-27T17:52:26Z","updated_at":"2015-09-01T05:39:46Z","closed_at":"2015-08-27T20:34:14Z","pull_request":{"url":"https://api.github.com/repos/ratpack/ratpack/pulls/767","html_url":"https://github.com/ratpack/ratpack/pull/767","diff_url":"https://github.com/ratpack/ratpack/pull/767.diff","patch_url":"https://github.com/ratpack/ratpack/pull/767.patch"},"body":"What allows to use extensions like https://github.com/Netflix/governator.\r\n\r\nratpack.groovy part example:\r\n```groovy\r\nserverConfig {\r\n  props \"server.GuiceInjectorFactory\": GuiceInjectorFactory.name\r\n}\r\n```\r\nCustom factory example:\r\n```groovy\r\nimport com.netflix.governator.guice.LifecycleInjector\r\n\r\nclass GuiceInjectorFactory extends AbstractGuiceInjectorFactory {\r\n  GuiceInjectorFactory(ServerConfig serverConfig) {\r\n    super(serverConfig)\r\n  }\r\n\r\n  @Override\r\n  Injector apply(Module module) throws Exception {\r\n    def builder = LifecycleInjector.builder()\r\n        .inStage(serverConfig.isDevelopment() ? DEVELOPMENT : PRODUCTION)\r\n        .usingBasePackages(GuiceInjectorFactory.package.name)\r\n    if (module)\r\n      builder.withModules(module)\r\n    builder.build().createInjector()\r\n  }\r\n}\r\n```\r\n\r\nInitially, I thought of basic registry usage where you optionally put custom factory, but I was not able to quickly get how to implement such approach. As a result I ended up with quick dirty solution based on server config. Please, propose better way if possible.\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/ratpack/ratpack/767)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/ratpack/ratpack/issues/comments/136591637","html_url":"https://github.com/ratpack/ratpack/pull/767#issuecomment-136591637","issue_url":"https://api.github.com/repos/ratpack/ratpack/issues/767","id":136591637,"user":{"login":"alkemist","id":17825,"avatar_url":"https://avatars.githubusercontent.com/u/17825?v=3","gravatar_id":"","url":"https://api.github.com/users/alkemist","html_url":"https://github.com/alkemist","followers_url":"https://api.github.com/users/alkemist/followers","following_url":"https://api.github.com/users/alkemist/following{/other_user}","gists_url":"https://api.github.com/users/alkemist/gists{/gist_id}","starred_url":"https://api.github.com/users/alkemist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alkemist/subscriptions","organizations_url":"https://api.github.com/users/alkemist/orgs","repos_url":"https://api.github.com/users/alkemist/repos","events_url":"https://api.github.com/users/alkemist/events{/privacy}","received_events_url":"https://api.github.com/users/alkemist/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T05:39:46Z","updated_at":"2015-09-01T05:39:46Z","body":"@phigoro what's the definition of `governatorInjector`?"}}