>>>>> Steinar Bang <s...@dod.no>:
>>>>> David Jencks <david.a.jen...@gmail.com>:

>> 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:

Another thing this explains: why the pax exam integration test worked,
while actually running the app in karaf didn't work.  Using @Inject in
the pax exam integration test registers an interest for the service
provided by OSGi bundle number two.

>> 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.

Specifying immediate=true made everything work, thanks!
 
https://github.com/steinarb/ukelonn/blob/c14dfbb9a1e0f59a0ac407ec9d82281e29f67097/ukelonn.bundle/src/main/java/no/priv/bang/ukelonn/impl/UkelonnServiceProvider.java


Reply via email to