google-code-export / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
2 stars 1 forks source link

Context-sensitive Providers #412

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Some Providers need an injection context (such as what Class the object is
being injected into) in order to satisfy the request. For example,
constructor-injected Logger instances need to know the class being injected
into, as follows:

@Provider Logger providerLogger(InjectionContext context)
{
  return Logger.getLogger(context.getInjectee().getClass().getName());
} 

Here is the related discussion thread:
http://groups.google.com/group/google-guice/browse_thread/thread/8f55d2eaa1a334d
f/384a2ec51b58e112?#384a2ec51b58e112

Original issue reported on code.google.com by gili.tza...@gmail.com on 14 Aug 2009 at 2:00

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 2 May 2010 at 12:32