What should be done to make sure the user service mapping for the service component is available?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @JakeCham
Correct Ans is
D. Create a field of type ServiceUserMapper and annotate it with @reference using ReferencePolicy.STATIC.
The ServiceUserMapper service is a core Apache Sling service and will typically be available before any custom services that depend on it. Thus, the OSGi references to this service should be satisfied with a static reference policy. The @Reference annotation with ReferencePolicy.STATIC is used to inject a reference to the necessary service, in this case, ServiceUserMapper. It means that the reference to the ServiceUserMapper OSGi service will be injected when the component is activated.
Thanks,
Venkat
Hi @JakeCham
Correct Ans is
D. Create a field of type ServiceUserMapper and annotate it with @reference using ReferencePolicy.STATIC.
The ServiceUserMapper service is a core Apache Sling service and will typically be available before any custom services that depend on it. Thus, the OSGi references to this service should be satisfied with a static reference policy. The @Reference annotation with ReferencePolicy.STATIC is used to inject a reference to the necessary service, in this case, ServiceUserMapper. It means that the reference to the ServiceUserMapper OSGi service will be injected when the component is activated.
Thanks,
Venkat
@JakeCham Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes