"DGuralnik" wrote : I wouldn't like switching to 2.0 because JBoss AS 4.0.5
has Microcontainer 1.0.
|
Yes, but as a separate deployer, right?
"DGuralnik" wrote :
| I think the stateless bean is not important in the discussion. I don't understant
how to use this Microcontainer. Spring was pretty easy.
|
MC as an IoC is a lot more than Spring.
But it is meant for different purpose - app. server kernel, service state machine... not
so much with huge Utils and good alround hooks.
We are working on it to provide better hooks, more documentation, examples, ...
"DGuralnik" wrote :
| So I has beans I declared in jboss-beans.xml. To load them I need a kernel controller
as Wiki says. Well, I create ActionFactory with the kernel controller in it and expected
using it as a factory for other beans (defined in jboss-beans.xml). The question is how to
create ActionFactory. If it was Spring I would use some factory class provided by Spring.
But here I didn't find a common approach to get the class instance. What should I do
to get ActionFactory instance and then call getBean("addProvider").
|
|
|
| | package com.mcp.server.action;
| |
| | import org.jboss.dependency.spi.ControllerContext;
| | import org.jboss.kernel.spi.dependency.KernelController;
| | import org.jboss.kernel.spi.dependency.KernelControllerContext;
| | import org.jboss.kernel.spi.dependency.KernelControllerContextAware;
| |
| | public class ActionFactory implements KernelControllerContextAware {
| | private KernelController controller;
| |
| |
| | public Object getBean(String name) {
| | ControllerContext context = controller.getInstalledContext(name);
| | return context.getTarget();
| | }
| |
| | public void setKernelControllerContext(KernelControllerContext arg0) throws
Exception {
| | controller = arg0.getKernel().getController();
| |
| | }
| |
| | public void unsetKernelControllerContext(KernelControllerContext arg0) throws
Exception {
| | // TODO Auto-generated method stub
| |
| | }
There are ways - register bean into JNDI, MBeanServer, ... And then get them out from
there as well.
I agree, should be better documented, but currently you are on your own - hopefully not
for long.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3999228#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...