Dagger 2 support
Is there any plan to support Dagger 2? Thanks
Since Dagger 2 has no dynamism, I'm not even sure this will be possible. I will spend some time looking into possible way to do this. I am also open to accepting a pull request for this if you know of a way to implement it.
sorry for buggin you, but ... any thoughts? thanks
Since Dagger 2 removes the ability to use ObjectGraph.get(), implementing this won't be straight forward.
Based on what I've read about Dagger 2 the way this would have to work is that all servlet and jersey injectable classes would need to have the @Component annotation. Then anywhere a class is needed dynamically for the servlet framework or jersey the factory class would have to be loaded dynamically from a String.
For example if there was an OAuth servlet filter that was being injected and the servlet framework asked for the class com.example.OAuthFilter then the String com.example.Dagger_OAuthFilter would have to be built by taking the package of OAuthFilter and then appending Dagger_ followed by OAuthFilter. The code to do this might look something like the below example.
String className = // determine class name: com.example.Dagger_OAuthFilter in this case
Class clazz = Class.forName(className);
Method createMethod = clazz.getDeclaredMethod("create", null);
Object injectedObj = createMethod.invoke(null, null);
This is also complicated by the fact that this could only support Dagger generated implementations that have the create method.