如何在 Sling 中使用描述符文件配置 OSGi 服务?

How to configure an OSGi service using descriptor file in Sling?

我想使用文本文件配置 Apache Sling 服务用户映射器服务。我在 jcr_root/apps/sling/config 下创建了一个文件,这个文件叫做 org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.json。

这是文件的内容:

{
    "jcr:primaryType":"sling:OsgiConfig",
    "user.mapping" : "artifact.name=systemUserName"
}

文件已在 JCR 中创建并且属性已正确解析,但未配置服务。如何解决这个问题?

事实证明,要在 Sling 中配置服务,描述符文件必须存储在 jcr_root/apps/sling/install 目录下。

可以找到有关 Sling 安装程序的更多信息 here