As the title suggests, I would like to reference a service in a non-service class, the way I can think of is as follows :
@Component( immediate = true )
public class Foo {
@Reference
private Bar bar ;
}
But Foo
seems to be instantiated and references bar
when the plugin it's in starts up, if I new Foo()
, bar
is null.
Is there any way to make Foo
not instantiate automatically, but rather I can new
it myself and make bar
not null ?
In other words, must the Component
be created when the plugin starts ?