Now with the @Creatable
annotation is possible to mark a class to be injected without adding it in the EclipseContext
by hand in the life cycle:
However, what about the following scenario: lets say that I have an interface SomethingService
and some number of implementations, and I want to refer to one of those (i.e. the one annotated as creatable) by its interface, something like:
@Creatable
class Todo implements SomethingService {
@Inject
public Todo(SomeArg arg) {
// placeholder
}
}
// Field Injection
@Inject private SomethingService service; // Todo instance
This doesn’t seem to work at all. Is there a way to achieve what I need?