I am using androidannotations in an Android project and I have an EBean defined as:
@EBean(scope = Singleton)
class MyBean {
public void someFunction() {
}
}
This bean is created whenever it is first required, that is, whenever I have:
@Bean
MyBean myBean;
in some class.
I am also using EventBus in this project, and a function in MyBean
is a @Subscriber
. This function is not called (when an Event
is posted) because an instance of MyBean
does not exist (since I don't have the dependency anywhere). How can I create an instance of MyBean
without specifically adding the dependency anywhere?
My temporary solution is to simply define the bean in my Application class.