[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: MC facade / fancy handles

adrian@jboss.org do-not-reply at jboss.com
Thu Apr 10 13:27:01 EDT 2008


You're talking about old IOC style programming
i.e. registry.getBean(name);

I don't like this form of IOC since it means you are tied to the container api
and therefore not portable across IOC containers.

It should be discourged. The best way to get the bean is to inject it. :-)

But if you are going to do it, then you're better off using something like the locator
pattern examples I did in the initial user guide.

Either:
* Use the MC to build up a singleton hashtable name->object
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontainer/trunk/docs/examples/User_Guide/pojoDevelopment/locator/src/main/java/org/jboss/example/microcontainer/locator/HashtableLocator.java?revision=66902&view=markup
* Use the MC directly as the implementation detail of the locator
http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/projects/microcontainer/trunk/docs/examples/User_Guide/pojoDevelopment/locator/src/main/java/org/jboss/example/microcontainer/locator/ControllerLocator.java?revision=66902&view=markup



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4143262#4143262

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4143262



More information about the jboss-dev-forums mailing list