0

I have two case :

  1. @Reference anottation for field - I know how work this case, my servises bind so good

  2. But case @Reference anottation for class - I dont understand how it work @Component(immediate = true) @Service(MyManager.class) @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, referenceInterface = Messenger.class, bind = "bindMessenger", unbind = "unbindMessenger") public class MyManager {}

What different between this situations ?

Arnaud Denoyelle
  • 29,980
  • 16
  • 92
  • 148
Vitaliy
  • 59
  • 1
  • 1
  • 5

1 Answers1

0

You can also use the Lookup strategy with DS. The ComponentContext type has locateService methods. Before, if you want to use locateService to obtain a referenced service object, you would need to write your own xml component description. No, you will be able to use annotations to declare the reference and bnd will create the xml component description.

BJ Hargrave
  • 9,324
  • 1
  • 19
  • 27