如何部分覆盖 OOTB 组件的 osgi 配置?

How to override osgi config for OOTB component partially?

我想覆盖

的标准 osgi cq 组件配置
com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl.xml

默认配置适合我,但我只想更改一个选项。

我不想覆盖全部配置,而只想覆盖单个选项(minify 应设置为 false)。

As per the documentation,创建一个配置节点应该没问题,只覆盖您希望更改的值:

For each parameter that you want to configure create a property on this node:

  • Name: the parameter name as shown in the Felix Console; the name is shown in brackets at the end of the field description. For example, for Create Version on Activation use versionmanager.createVersionOnActivation
  • Type: as appropriate.
  • Value: as required.

You only need to create properties for the parameters that you want to configure, others will still take the default values as set by CQ. [emphasis mine]

只要确保不要用空白默认值覆盖值,例如:

<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0"     
          xmlns:jcr="http://www.jcp.org/jcr/1.0"
          jcr:primaryType="sling:OsgiConfig"
          cq.homeaclsetup.privileges.user="jcr:all"/>

应该将 cq.homeaclsetup.privileges.group 值保留为默认值,因为它根本没有包含在配置节点中。

据我所知,它会为组件选择默认值,而不是 AEM 的默认值 — 可能会出现错误libs/ 文件夹中的现成 OSGi 配置节点,您可以覆盖它,因此请注意这一点。

在这种情况下,您需要将配置复制到您的节点中,以免丢失。

在 /apps/system/config 下创建一个名为 "com.adobe.granite.ui.clientlibs.impl.HtmlLibraryManagerImpl" 的节点,并根据需要进行更改