[Design the new POJO MicroContainer] - Re: JBMICROCONT-309; aliases and scoping
by adrian@jboss.org
"alesj" wrote :
| But I would need some new SPI on the Controller to handle issue#1.
| I'm thinking of something like this
|
| | ControllerContext getLocalContext(Object name, ControllerState state);
| |
|
Scoping is an implementation detail and so such a call should
be part of those implementation details not the SPI.
I think if you've got something called "ScopedAlias" and
"ScopedController" that are both implementation details then it is better
they talk to each other using non-SPI.
You can see this by just asking "What does a LocalContext mean?" when you
look at the Controller SPI.
If you want to introduce scoping into the SPI then think about and do it properly
instead of just hacking one method into it which is unrelated to its
"do one thing well" contract.
i.e. add the methods to the contract that allow you to specify the structure
and have an alternate "scoping" implementation (e.g. peer instead hierarchical).
But this route seems like overkill for the sake of one method call unless you
can see further enhancements in this area in the future?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4161997#4161997
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4161997
16 years, 6 months
[Design the new POJO MicroContainer] - Re: JBMICROCONT-309; aliases and scoping
by alesj
"alesj" wrote :
| Issue#1: Controller should have option to do just local lookup - otherwise order of bean deployment is important; e.g. picking up bean from parent (already available), where you would actually want scoped one (not available at dependency item resolution)
| This can also lead to CCE issues; parent bean being of wrong type
|
I'm pretty much done on other issues (I won't be moving direct alias registration into post PreInstall, since there is a simple workaround).
But I would need some new SPI on the Controller to handle issue#1.
I'm thinking of something like this
| ControllerContext getLocalContext(Object name, ControllerState state);
|
Which would be noop.
It's just that scoped controller wouldn't return parent's contexts as well.
Then user could mark inject as local.
| <inject bean="mybean" local="true"/>
|
And then alias could also have option to be just locally resolved - probably similar way as I did scoped alias -> via new alias controller context.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4161985#4161985
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4161985
16 years, 6 months