"[EMAIL PROTECTED]" wrote : Say I've got a service that has some dependencies that need to be injected before it can start up. | My first question is, when do the dependencies get injected, with relation to the service lifecycle methods? | It again depends where you want to inject. ;-)
Lifecycle order: ControllerState.NOT_INSTALLED ControllerState.PRE_INSTALL ControllerState.DESCRIBED ControllerState.INSTANTIATED ControllerState.CONFIGURED ControllerState.CREATE ControllerState.START ControllerState.INSTALLED Constructor injection happens as Instantiated. Property injection at Configured. Create method invocation (+ parameter injections) at create. :-) Start at ... And I've just added that installs can be applied at any state: - http://jira.jboss.com/jira/browse/JBMICROCONT-242 "[EMAIL PROTECTED]" wrote : And secondly, how can I, within my service bean, validate that all the required dependencies are met? | You don't need to. If you define your dependencies right (and it's a very pluggable system aka defining you own dependencies is trivial), MC is gonna take care that they are all met, or the service won't move fwd. "[EMAIL PROTECTED]" wrote : If there's a problem, can I e.g. throw an exception from my start() method to prevent the service from being started, or is there a "cleaner" way to validate dependencies? | If whatever exception is thrown during any state of bean/service lifecycle, the MC is gonna put this context into error state. See this discussion for more details: - http://www.jboss.org/index.html?module=bb&op=viewtopic&t=130374&start=0 But you can manually move service in MC. And perhaps if the validation at that point is negative you move your service a (few) step(s) back. And proceed when you expect all is OK. It's again all about what is valid for you. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4131561#4131561 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4131561 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user