users@glassfish.java.net

Re: Can hk2:run be used to run anything meaningful?

From: Sahoo <Sahoo_at_Sun.COM>
Date: Fri, 16 Jan 2009 11:16:36 +0530

glassfish_at_javadesktop.org wrote:
> In all instructions that I've read online regarding the use of the HK2 Maven plugin, I found nothing about how to use hk2:run to run an application that does anything meaningful (besides loading its modules, I mean). Upon each "mvn hk2:run", the start() of my module that implements ModuleStartup gets called, and that's it -- the JVM just exits "successfully".
>
> So... sorry if this is a dumb question, but where's the "main()", or the "run()"? I'm not supposed to do everything in start(), am I?
Yes, you are. Sorry for the lack of any proper documentation. You should
put all your logic in start() method. After start() returns, hk2:run is
supposed to call stop() after which the JVM should exit. hk2:run is not
calling stop() right now; it's a bug.

By the way, are you interested in HK2 for its module management
facilities or DI capabilities? We in GlassFish use DI facilities from
HK2 and use OSGi as the module layer.

Thanks,
Sahoo