{"action":"created","issue":{"url":"https://api.github.com/repos/ben-manes/caffeine/issues/117","repository_url":"https://api.github.com/repos/ben-manes/caffeine","labels_url":"https://api.github.com/repos/ben-manes/caffeine/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/ben-manes/caffeine/issues/117/comments","events_url":"https://api.github.com/repos/ben-manes/caffeine/issues/117/events","html_url":"https://github.com/ben-manes/caffeine/issues/117","id":173032951,"number":117,"title":"Support instantiating CacheLoader and CacheWriter with a Guice injector","user":{"login":"chrisstockton","id":8291994,"avatar_url":"https://avatars.githubusercontent.com/u/8291994?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisstockton","html_url":"https://github.com/chrisstockton","followers_url":"https://api.github.com/users/chrisstockton/followers","following_url":"https://api.github.com/users/chrisstockton/following{/other_user}","gists_url":"https://api.github.com/users/chrisstockton/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisstockton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisstockton/subscriptions","organizations_url":"https://api.github.com/users/chrisstockton/orgs","repos_url":"https://api.github.com/users/chrisstockton/repos","events_url":"https://api.github.com/users/chrisstockton/events{/privacy}","received_events_url":"https://api.github.com/users/chrisstockton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-08-24T19:06:29Z","updated_at":"2016-08-26T03:01:14Z","closed_at":null,"body":"Currently any read-through.loader and write-through.writer instances are created using ```FactoryBuilder.factoryOf(\"className\")``` which just delegates to ```Class.forName(\"className\").newInstance()```.  This is fine for simple loaders, but I find that I want to inject a dependency into my CacheLoader/Writers so that they can connect to some remote persistent storage.\r\n\r\nIt would be nice if the creation of these loaders could be handled by Guice, if so configured.  Here's a quick stab at how it could be done:  https://github.com/ben-manes/caffeine/compare/master...chrisstockton:guice-factory?expand=1\r\n\r\nIt relies on static injection of an injector which doesn't seem super ideal, but considering the alternative is just using Class.forName(...).newInstance(), it at least doesn't seem like a step back.\r\n\r\nIt would also require someone to make a call to requestStaticInjection(GuiceFactory.class) in a module somewhere, but that seems not too onerous."},"comment":{"url":"https://api.github.com/repos/ben-manes/caffeine/issues/comments/242614787","html_url":"https://github.com/ben-manes/caffeine/issues/117#issuecomment-242614787","issue_url":"https://api.github.com/repos/ben-manes/caffeine/issues/117","id":242614787,"user":{"login":"ben-manes","id":378614,"avatar_url":"https://avatars.githubusercontent.com/u/378614?v=3","gravatar_id":"","url":"https://api.github.com/users/ben-manes","html_url":"https://github.com/ben-manes","followers_url":"https://api.github.com/users/ben-manes/followers","following_url":"https://api.github.com/users/ben-manes/following{/other_user}","gists_url":"https://api.github.com/users/ben-manes/gists{/gist_id}","starred_url":"https://api.github.com/users/ben-manes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ben-manes/subscriptions","organizations_url":"https://api.github.com/users/ben-manes/orgs","repos_url":"https://api.github.com/users/ben-manes/repos","events_url":"https://api.github.com/users/ben-manes/events{/privacy}","received_events_url":"https://api.github.com/users/ben-manes/received_events","type":"User","site_admin":false},"created_at":"2016-08-26T03:01:14Z","updated_at":"2016-08-26T03:01:14Z","body":"One concern with `javax.inject.Inject` is that I don't know how Spring's classpath scanning interacts with it. I haven't used it since 2.0 days, but I think that one usually restricted it to your company's package to reduce startup time. I wouldn't want the annotation to cause a breakage due to the standard not supporting optional / providedBy.\r\n\r\nSince you've used Spring much more recently than I have, do you know if that's going to cause mayhem?"}}
{"actor":{"display_login":"ben-manes"}}