如何将 AdaptorFactory class 的 scr 注释迁移到 OSGI R6 注释?

How to migrate scr annotations of AdaptorFactory class to OSGI R6 annotations?

我们正在从 AEM 6.0 迁移到 6.3,并且正在从 Felix 迁移到 OSGI scr 注释。 我有这样的代码

@Component
@Service(AdapterFactory.class)
@Properties({
        @Property(name = "CustomManagerAdapter", value = "adapter/factory"),
        @Property(name = SlingConstants.PROPERTY_ADAPTABLE_CLASSES, value = {
            "org.apache.sling.api.resource.ResourceResolver",
            "org.apache.sling.api.SlingHttpServletRequest",
            "org.apache.sling.api.resource.Resource"
        }),
        @Property(name = SlingConstants.PROPERTY_ADAPTER_CLASSES, value = "com.myapp.util.user.CustomUser")
})
public class CustomUserAdapter implements AdapterFactor

如何将 SlingConstants.PROPERTY_ADAPTABLE_CLASSES 等多值属性放入 R6 注释中?

我试过:

@Component(service = AdapterFactory.class, property={
        SlingConstants.PROPERTY_ADAPTER_CLASSES + "=com.myapp.util.user.CustomUser",
        SlingConstants.PROPERTY_ADAPTABLE_CLASSES+"={\"org.apache.sling.api.resource.ResourceResolver\"}",
        "CustomManagerAdapter=adapter/factory"
})

这没有用。请分享一个迁移多值属性的示例。

要注册多值属性,请多次重复 属性 的声明。键,即 属性 名称保持不变,而 属性 值发生变化。

例如:

@Component(
service = AdapterFactory.class,
immediate = true,
property = {
    "adaptables=org.apache.sling.api.resource.Resource",
    "adaptables=org.apache.sling.api.SlingHttpServletRequest",
    "adapters=<Myclass>"
 }
)