I wonder if I can use (is it necesarry?) @Autowired annotation for dependency injection in Cuba or it is replaced with specific Cuba API like metadata.create (Class…) or @Injection?
public class A{
private B b;
@Autowired
public void setB(B b){
this.b=b;
}
}
You can use them both, @Autowired and @Inject are almost interchangeable in CUBA applications. For instance, you may use @Autowired to specify that the required dependency is optional.
public class FooService {
@Autowired(required = false)
private FooDAO dataAccessor;
}