如何将AdapterFactory类的scr注释迁移到OSGI R6注释?
我们正在从AEM 6.0迁移到6.3,并正在从Felix迁移到OSGI scr注释。 我有这样的代码如何将AdapterFactory类的scr注释迁移到OSGI R6注释?,osgi,aem,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
@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_\u类)添加到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"
})
这不管用。请分享迁移多值属性的示例 要注册多值属性,请多次重复该属性的声明。当属性值更改时,键(即属性名称)保持不变 例:
@组件(
服务=AdapterFactory.class,
立即=真,
属性={
“Adaptiables=org.apache.sling.api.resource.resource”,
“Adaptebles=org.apache.sling.api.SlingHttpServletRequest”,
“适配器=”
}
)
要注册多值属性,请多次重复该属性的声明。当属性值更改时,键(即属性名称)保持不变
例:
@组件(
服务=AdapterFactory.class,
立即=真,
属性={
“Adaptiables=org.apache.sling.api.resource.resource”,
“Adaptebles=org.apache.sling.api.SlingHttpServletRequest”,
“适配器=”
}
)
@Component(
service = AdapterFactory.class,
immediate = true,
property = {
"adaptables=org.apache.sling.api.resource.Resource",
"adaptables=org.apache.sling.api.SlingHttpServletRequest",
"adapters=<Myclass>"
}
)