Any example of static dagger injections 2. I already tried this: -
class A{ @Inject static B b; static { getAppInstance().getComponent().inject(A.class); } static anyMethod(){ b.anotherMethod(); } }
public interface AppComponent{ void inject(Class<A> aClass); }
So this is my suggested answer: -
class A{ private static B b = getAppInstance.getComponent().getB(); static anyMethod(){ b.anotherMethod(); } }
public interface AppComponent{ B getB(); }
Source: https://habr.com/ru/post/1241040/More articles:Android Is ActiveJDBC possible? - javaMDX query to find the last unused value in icCube - performanceImplicit Call Chain Calculation - scalaWhy is flatMap on Vector [Option [Int]] whose function of the mapping function is not Vector [Option [Int]] valid? - scalaHow to set Atom-Beautify Wrap HTML attribute - htmlVBA is the best way to copy data from a closed book - vbaGenerating random numbers with weighted probabilities in python - pythonCreate a list of random weighted tuples from a list - pythonClick "Receive unexpected extra arguments" when passing a string - pythonng-change not working on input - javascriptAll Articles