[picocontainer-scm] [jira] (PICO-386) Component resolution should respect scope from which it was resolved
"Rikard Pavelic (JIRA)" <jira-yCVjj/[email protected]> Tue, 14 Feb 2012 13:17:03 -0600 (CST)
| Newsgroups | gmane.comp.java.picocontainer.cvs |
|---|---|
| Message-ID | <841949282.37079.1329247023975.JavaMail.j2ee-jira@codehaus01.managed.contegix.com> |
[ https://jira.codehaus.org/browse/PICO-386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=291653#comment-291653 ]
Rikard Pavelic commented on PICO-386:
-------------------------------------
I finally found some time to take a look at this.
I've got it working in a hackish way ;)
You can take a look at https://github.com/zapov/picocontainer/commit/d103eb52a62d17399df313d1640fd5706c0715f3 too see what I had to do.
If you like this approach I can refine it some more, although I think it would be better if someone more familiar with the code refined it :)
Regards,
Rikard
> Component resolution should respect scope from which it was resolved
> --------------------------------------------------------------------
>
> Key: PICO-386
> URL: https://jira.codehaus.org/browse/PICO-386
> Project: PicoContainer
> Issue Type: Bug
> Components: PicoContainer (Java)
> Affects Versions: 2.14.1
> Reporter: Rikard Pavelic
> Assignee: Paul Hammant
>
> I've encountered behavior which looks like a bug to me, but this is maybe by design. I'm not really fluent in Java so I'll write example in Scala. Hope that's ok.
> class A(b: B)
> class B(name: String)
> val container = new DefaultPicoContainer
> container.addComponent(classOf[A])
> container.addComponent(new B("root"))
> val scope = container.makeChildContainer
> scope.addComponent(new B("child"))
> val a = scope.getComponent(classOf[A])
> expected: a.b.name = "child"
> actual: a.b.name = "root"
> It seems that Pico doesn't respect full dependency path when resolving components registered in parent container. It resolves component based on registration path, not resolution path. This makes it unusable for chaining state and overriding non-trivial components.
> I suspect that this change will probably be code invasive, so before I take a better look at what Pico is doing I'm just wondering if you are interested in this behavior, did you try to implement it, but it was to complex, or any other info.
> Thanks,
> Rikard
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
<hr/>
<p>
To unsubscribe from this list please visit:
</p>
<p>
<a href="http://xircles.codehaus.org/manage_email">http://xircles.codehaus.org/manage_email</a>
</p>