vendredi 12 juin 2015

Is @DependsOn necessary for another CDI bean that is injected?

Given two beans annotated with @Startup:

@Singleton    
@Startup
@DependsOn("B")
public A {
  @Inject
  private B b;
}

@Singleton    
@Startup
public B {}

Is @DependsOn neccessary in this situation to ensure that B is initialized before A? Or is there some convention over configuration that in such a situation the order of injections determines the order of initialization?

The official tutorial does not cover this case but only beans that are merely semantically covered without any syntactic/wiring link via @Inject.

Aucun commentaire:

Enregistrer un commentaire