-3

I am migrating some SCR annotations based code base to OSGi R6.

The current code uses scr annotations and fields which are not available in R6.

For example: @references and referenceInterface are not supported in R6

@Component
@References({
  @Reference(
  referenceInterface = SomeFactory.class,
  policy = ReferencePolicy.DYNAMIC,
  cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE)
})

@Service
public class SomeResolverImpl implements SomeResolver { }
SubSul
  • 2,523
  • 1
  • 17
  • 27

1 Answers1

0

The OSGi R6 annotation set does indeed have a @Reference annotation. See section 112.13.8 of the OSGi R6 Compendium Specification. Or, here is a direct link to the online R7 specification.

You should place this annotation either on the field or the method that you wish to bind to the service reference.

Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
  • I am asking about @references annotation (which is added at class level). Please go through this class : https://github.com/Adobe-Marketing-Cloud/aem-guides/blob/master/simple-search-guide/core/src/main/java/com/adobe/aem/sample/simple/search/predicates/impl/PredicateResolverImpl.java – Rahul Doshi Jan 24 '19 at 12:43
  • What are you asking about it? In OSGi annotations you have to put the `@Reference` annotation on the injected field or method. This makes much more sense, BTW! – Neil Bartlett Jan 24 '19 at 14:44