Comments (19)
From kevinb9n on February 28, 2007 11:14:44
What about including any already-initialized singletons from the original container?
This could possibly allow us to solve our functional testing "speed vs. safety"
problems, as we can actually create and launch a whole new server for every test
while reusing only those damned expensive singletons.
from guice.
From crazyboblee on February 28, 2007 12:04:24
We would pretty much have to do that. I also think sharing the instance is the least
surprising behavior.
from guice.
From crazyboblee on February 28, 2007 14:46:31
Container has been renamed Injector.
I think being able to pass an Injector to a Binder is pretty safe and has a lot of
potential uses.
Labels: 1.0RC3
from guice.
From crazyboblee on February 28, 2007 14:48:44
Container has been renamed Injector.
I think being able to pass an Injector to a Binder is pretty safe and has a lot of
potential uses.
from guice.
From crazyboblee on March 02, 2007 13:20:45
Deferring until I figure out how we want to do this.
Should the containers share implicit bindings, too? i.e. consider an implicit
singleton. If the child container delegates to the parent container for implicit
bindings, how will the parent get access to the child's explicit bindings?
We need to copy scope bindings, too.
How will method interception work? I suppose we need to expose and copy the method
aspects. If we share implicit bindings, then interceptors applied for the child won't
apply...
I think keeping implicit bindings separate and only copying explicit bindings is the
way to go.
Labels: -1.0RC3
from guice.
From crazyboblee on March 13, 2007 15:31:34
(No comment was entered for this change.)
Summary: Support chaining injectors.
from guice.
From kevinb9n on June 03, 2007 11:01:39
People who want this feature, please-pretty-please add your use cases here. thanks.
from guice.
From crazyboblee on June 03, 2007 11:07:32
I don't think we should implement this. You can always enforce layering when compiling.
from guice.
From kevinb9n on June 03, 2007 11:38:39
I've gotten the general sense that there are other reasons besides layering why
people want this. We'll see.
from guice.
From oliver.buchtala on February 16, 2008 16:43:34
Hi,
I don't know the current state of this issue. But I have 'working' prototype.
I very much like the idea of injector chains.
First my usecase: (robot-leg)
I have many kind of algorithms that have similar 'signatures', e.g., working on sets
of data-instances(e.g. Iterable<Data>). Now, I have to use several of them, each
working on a different data-set instance - or a certain subset of the whole data-set.
Furthermore, i like to have the same algorithm working on different parts of my data
set (or different instances).
I think, this is very much a robot-leg-problem.
I tried to find out if Scopes are my solution - but, as I think, I have to bind the
my algorithm class to the scope. So, not several instances in several scopes. I also
think Scopes more as of a a living context. Not a visbility context - what I need.
I worked out a simple Prototype of an hierarchical binder impl that does what I
wish. It uses Providers living in different Injectors (e.g., child/parent injector)
and binds them in the other as concrete providers.
Additionally I added some kind of automatic Binding inheritance (i.e., global
bindings).
You find the source with a demonstrative example in the attached file.
Current problem: eagerSingletons - may lead (very likely) to calls on the bridging
providers before the bridged injector was created. (...I don't like asEagerSingleton
at all).
What do you think?
Greetz,
Oliver
Binary attachments: GuiceWithHierarchicalModules.zip
from guice.
From limpbizkit on May 30, 2008 00:26:36
Dan Halem has implemented a prototype of this in Guice svn. But I'd still like to make a thorough examination of
all of this code and its consequences. I'm particularly anxious about this for 2.0.
from guice.
From limpbizkit on June 06, 2008 09:24:46
(No comment was entered for this change.)
Summary: Support chaining injectors / parent injectors
Labels: Milestone-Release2.0
from guice.
From limpbizkit on June 17, 2008 11:32:40
There's a bug in the current implementation where deep hierarchies are not honoured: http://groups.google.com/group/google-guice/browse_frm/thread/4689199d93d76ecb
from guice.
From medotin on July 11, 2008 10:10:24
@
13
Have not tested for implications, but a workaround seems to be changing
Scopes.NO_SCOPE to binding.getScope() on this line: http://fisheye2.atlassian.com/browse/google-guice/trunk/src/com/google/inject/InjectorImpl.java?r=555#l254
from guice.
From medotin on July 11, 2008 10:12:42
Oops, wrong line number: http://fisheye2.atlassian.com/browse/google-guice/trunk/src/com/google/inject/InjectorImpl.java?r=555#l173
from guice.
From sven.linstaedt on September 10, 2008 01:55:13
There is another bug: Constant bindings are not inherited from the parent injector.
So while retrieving an object which depends on constant bindings from the parent
injector works, the same object can not be retrieved from a child injector of this
parent one. Guice states that the constant dependency is not bound.
from guice.
From limpbizkit on October 14, 2008 16:43:45
I've rewritten parent injectors from scratch. From the Injector.java API:
/**
* Returns a new injector that inherits all state from this injector. All
* bindings, scopes, interceptors and type converters are inherited -- they
* are visible to the child injector. Elements of the child injector are not
* visible to its parent.
*
* <p>Just-in-time bindings created for child injectors will be created in an
* ancestor injector whenever possible. This allows for scoped instances to be
* shared between injectors. Use explicit bindings to prevent bindings from
* being shared with the parent injector.
*
* <p>No key may be bound by both an injector and one of its ancestors. This
* includes just-in-time bindings. The lone exception is the key for {@
code
* Injector.class}, which is bound by each injector to itself.
*/
Injector createChildInjector(Iterable<? extends Module> modules); https://code.google.com/p/google-guice/source/detail?r=629
Status: Started
Owner: limpbizkit
from guice.
From sven.linstaedt on October 15, 2008 06:20:35
Have a look at related discussion: http://groups.google.com/group/google-guice-dev/browse_thread/thread/c097874268bf9209?hl=en
from guice.
From limpbizkit on November 12, 2008 17:18:57
Implemented and now threadsafe. Hooray!
Status: Fixed
from guice.
Related Issues (20)
- Can I have more than one aspect for a method and if yes how to ensure order of them with Guice AOP
- Spark2.4.7,Guice:4.0: java.lang.ArrayIndexOutOfBoundsException: 67737
- Deadlock in multi-threading enviroment (Guice 5.1)
- enable @Inject for records HOT 4
- InternalProvisionException.errorInUserCode discards important context about user errors HOT 1
- Annotations @Provides and @Singleton do not work together HOT 2
- HiddenClassDefiner incorrectly assumes Unsafe.staticFieldBase(Field) returns a real Object HOT 8
- Bob Lee,God bless You
- Feature Request: MicroProfile-config integration: Allow injecting annotations with jakarta.inject.Qualifier HOT 12
- where are the installation instructions? HOT 4
- java.lang.ClassCastException: class com.google.inject.servlet.GuiceFilter cannot be cast to class jakarta.servlet.Filter (com.google.inject.servlet.GuiceFilter is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @e383572; jakarta.servlet.Filter is in unnamed module of loader java.net.URLClassLoader @2ef1e4fa) HOT 1
- Changed behaviour in Guice 7 HOT 3
- Struts 6.x.x not working with Guice HOT 9
- Possible leak using Guice HOT 5
- Performance Issue in getJustInTimeBinding Method HOT 1
- Misleading exception message for nested Guice injector failure
- 8 Flaky tests in the module extensions/throwingproviders
- Request/Question: Provide non-jarjar'd builds
- Guice AOP is not compatible with Kotlin Coroutines HOT 2
- Enable to define a custom "@Inject" marker (ie add some extension point for reflection doing getAnnotation/isAnnotationPresent on this marker)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from guice.