On Wed, Dec 2, 2020 at 6:09 PM Pavel Horal <pavel.ho...@orchitech.cz> wrote:

> ---
> My sample component:
> @Component(
>         name = "hello",
>         property = "service.pid=hello",

This is not quite correct actually. I would have expected SCR to complain
about this because service.pid should be one of the "managed" component
properties. (i.e. never pass service.pid as a property)

Since you have set _name_ property, what you want is simply:

> @Component(
>         name = "hello",

        immediate = true)
> public class HelloComponent { ... }

... without setting _configurationPid_ property, 'service.pid' is implied
from _name_.

With that, you should notice that your component responds as you expect
when a configuration with pid "hello" appears.


PS: _All components are configurable_ (even ones you never anticipated
passing configuration to) because they always infer at least their
component name as a service.pid (AFAIC this is one of the most understated
wonders of DS.)

*Raymond Augé* (@rotty3000)
Senior Software Architect *Liferay, Inc.* (@Liferay)
OSGi Fellow

Reply via email to