In addition to what Ray wrote, service.pid is defined as a multi value string property. If code is inspecting this property it must deal with that.

Regards
Carsten

Am 03.12.2020 um 04:27 schrieb Raymond Auge:
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.

HTH

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


--
--
Carsten Ziegeler
Adobe Research Switzerland
cziege...@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to