>>>>> David Jencks <[email protected]>: > One point some ds beginners miss is that if your component provides a > service by default it is delayed and won’t be instantiated until the > service is used.
Ahh! That explains why the first component isn't instantiated until the second bundle is loaded, and why the second component shows up only as SATISFIED: karaf@root()> scr:components ID | State | Component Name ---+-----------+------------------------------------------------------------ 1 | ACTIVE | org.ops4j.pax.web.service.internal.WhiteboardDtoService 2 | ACTIVE | no.priv.bang.ukelonn.bundle.db.test.UkelonnDatabaseProvider 3 | ACTIVE | org.ops4j.pax.web.deployer.internal.WarDeployer 4 | SATISFIED | no.priv.bang.ukelonn.impl.UkelonnServiceProvider karaf@root()> > This laziness is great but can be confusing. Specify immediate=true if > you want to see all the components instantiated as soon as all their > dependencies are satisfied. Thanks! I will try this. My prior attempts at DS has been servlets for the Pax Web Whiteboard Extender, and there, of course, the components have been automatically instantiated and used... For the curious: here's the bundle activator I'm replacing (my own home brewed "mini dependency injection" system from a couple of years back): https://github.com/sbang/jsr330activator#jsr330activator---an-osgi-bundleactivator-implementing-whiteboard-based-dependency-injection Why I'm phasing it out: https://github.com/sbang/jsr330activator#is-the-jsr330activator-necessary-after-declarative-services-arrived
