활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
활동이 없어 이 대화는 잠겼습니다. 새 게시물을 작성해 주세요.
Can we use @reference annotation in normal class or can we get osgi services in normal class in aem
해결되었습니다! 솔루션으로 이동.
조회 수
답글
좋아요 수
What do you mean by "normal" class? If you mean plain Java classes POJO (Plain Old Java Object) the simple answer is No.
the @reference
annotation is part of the OSGi Declarative Services (DS) specification. It is used to inject OSGi services into OSGi component classes, which are typically OSGi service components.
The @reference
annotation cannot be used directly in a normal Java class because it is specifically meant for OSGi service components that are registered and managed by the OSGi framework. Normal Java classes are not part of the OSGi service registry, and hence, the @reference
annotation is not applicable to them.
What do you mean by "normal" class? If you mean plain Java classes POJO (Plain Old Java Object) the simple answer is No.
the @reference
annotation is part of the OSGi Declarative Services (DS) specification. It is used to inject OSGi services into OSGi component classes, which are typically OSGi service components.
The @reference
annotation cannot be used directly in a normal Java class because it is specifically meant for OSGi service components that are registered and managed by the OSGi framework. Normal Java classes are not part of the OSGi service registry, and hence, the @reference
annotation is not applicable to them.
the @reference annotation can not be used in normal Java classes,you can use the @reference annotation to inject references to other OSGi services into the component class.
For example, in a Sling Model class, you can use the @reference annotation to inject an OSGi service
import org.osgi.service.component.annotations.Reference;
import org.apache.sling.models.annotations.Model;
@Model(adaptables = Resource.class)
public class MySlingModel {
@reference
private MyOsgiService myOsgiService;
// ... Rest of the code ...
}
조회 수
답글
좋아요 수