GithubHelp home page GithubHelp logo

Comments (19)

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

From crazyboblee on March 13, 2007 15:31:34

(No comment was entered for this change.)

Summary: Support chaining injectors.

from guice.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

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.

gissuebot avatar gissuebot commented on May 14, 2024

From limpbizkit on November 12, 2008 17:18:57

Implemented and now threadsafe. Hooray!

Status: Fixed

from guice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.