> On 28 Nov 2016, at 11:09, Nicolas Brasey <[email protected]> wrote:
> 
> Hi,
> 
> I have a bind order issue with a component that has :
> 
> 1) A static reference specified with annotation @Reference on the private
> field
> 2) A dynamic multiple reference specificed with annotation on a method
> 
> The static reference is not bound before the dynamic ones.


That is not required. Dynamic references can be bound, unbound or replaced at 
any time… even potentially *while* the static references are being bound, or 
while the activate is executing.


> 
> The code looks like this:
> 
> @Component(immediate = true)
> public class MyServiceImpl implements MyService {
> 
>    @Reference
>    private AclService aclService;
> 
>    @Reference(
>            cardinality = ReferenceCardinality.MULTIPLE,
>            policy = ReferencePolicy.DYNAMIC
>    )
>    public void add(StateMachine stateMachine) {
>       ....
>        ....
>    }
> 
> 
> According to the Declarative Service specifications, the static references
> should always be injected before the activate method.


That’s correct.


> 
> 
> Does anyone have any idea what might be wrong ?


It doesn’t sound like anything is going wrong.

Regards,
Neil


> 
> 
> My env is Apache Karaf 4.0.5 with Felix SCR 2.0.2
> 
> 
> Thanks for you help!
> 
> Nicolas


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to