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

Sar*_*ash 0 osgi aem

我们正在从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
Run Code Online (Sandbox Code Playgroud)

如何将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"
})
Run Code Online (Sandbox Code Playgroud)

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

Sha*_*ppa 5

要注册多值属性,请多次重复该属性的声明.键,即属性名称在属性值更改时保持不变.

例如:

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