karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steinar Bang ...@dod.no>
Subject Re: What's the recommended way of reading configuration?
Date Sun, 03 Dec 2017 14:52:30 GMT
>>>>> Timothy Ward <tim.ward@paremus.com>:

> None of the above. When it comes to configuration you should always be
> using Configuration Admin to inject you, not getting a service. If
> you’re using DS then this configuration can be directly injected into
> your activate method, either as a Map or a Component Property Type.

Ok.

>> Does anyone know of code examples of any of the three approaches?
>> Preferrably DS w/annotation based code examples?

> There are examples out there, for example:
> I recently answered this question on Stack Overflow <https://stackoverflow.com/questions/47550999/cant-add-the-plus-button-in-osgi-apache-felix-web-console-to-create-new-configu/47557470#47557470>,
which includes metatype as well.
> Paremus have example applications using DS <https://github.com/paremus/hello-examples/blob/37c9b2b1ac430227f0d92bf336be6cf5a59c079a/helloworld/helloworld-ds/src/main/java/com/example/hello/impl/GreetingImpl.java>

> From OSGi enRoute <http://enroute.osgi.org/services/org.osgi.service.component.html#configuration>
(this link may change as enRoute content is updated/moved for OSGi R7).

Thanks!  Great examples! :-)

This looks extremely simple, and a way to get dependencies without
adding additional runtime dependencies to my bundle.


Mime
View raw message