Run() is called from an Injected instance, looks like the object isn't null but the ToString() seems to throw null instead of NPE. Looking at the stack trace.
Caused by: java.lang.NoSuchMethodException:com.example.car.ToString(). On Monday, March 18, 2019 at 3:22:22 AM UTC-5, scl wrote: > > How do you run the example where the NPE occurs? > Guice can only inject instances which are created by Guice or are passed > to the method injector.injectMembers(). > > I highly recommend to use constructor injection over field or method > injection. > Especially because it makes testing without Guice easier. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+unsubscr...@googlegroups.com. To post to this group, send email to google-guice@googlegroups.com. Visit this group at https://groups.google.com/group/google-guice. To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/cc1acf1d-fa42-4b4c-859c-c0a77eaace78%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.