How to implement a new guice scope that caches and return named instances?

纵饮孤独 提交于 2019-12-11 08:56:19

问题


I want to be able to connect to various back-ends by changing a custom header of my HTTP requests. Therefore I want that my request is served with a controller instance that is specific to the selected back-end. The controllers that serve the requests are created using Guice and have many dependencies. I want to cache these controller instances. So for each (SomeController.class, backend) pair there would be a cached instance.

How to implement such a Guice scope? I am using Play Framework 2.1.

来源:https://stackoverflow.com/questions/15556802/how-to-implement-a-new-guice-scope-that-caches-and-return-named-instances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!