frjaeger220 / google-guice

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

Singleton error checking for Guice Servlets and Filters #303

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Throw an error if keys are bound to non-singletons. Automatically bind unbound 
types (class key 
without annotation) as singletons.

Original issue reported on code.google.com by dha...@gmail.com on 4 Jan 2009 at 7:03

GoogleCodeExporter commented 9 years ago
We can't automatically bind unbound types as singletons. Ie. we don't have a 
mechanism to say
   if (!fooBindingExists) {
      bind(Foo).to(...)
   }

The best we can do is treat unbound types as singletons, by saving an instance 
manually. Isn't this what we'll be 
doing anyway?

Original comment by limpbizkit on 4 Jan 2009 at 6:32

GoogleCodeExporter commented 9 years ago
Yea we cache them at the pipeline level regardless. However, it is surprising 
behavior if the scopes are different. 
Maybe we can optimistically bind unbound types and leave 
filter(..).through(Key) upto the user to scope correctly.

We should blow up if scope is not singleton (on pipeline init) regardless.

Original comment by dha...@gmail.com on 4 Jan 2009 at 11:06

GoogleCodeExporter commented 9 years ago

Original comment by dha...@gmail.com on 7 Jan 2009 at 4:18