When I use OSGi API (an instance of ServiceRegistration) I can easily change the properties of service at runtime. How can I do the same with declarative service ? Is there any solution based on BndTool's annotation?

Many Thanks

有帮助吗?

解决方案

The answer is no. A service registered by DS for a component gets is service properties from the component properties. The component properties are set by the component description in the XML and also any Config Admin configuration used. Since you cannot change the XML, you can only change the configuration which is not something a component itself is expected to do.

If you need to change your service's service properties on the fly, your use case falls outside of the use cases supported by DS. You will need to use the OSGi service API.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top