What Is Wrong With Roboguice
I want to create a singleton object using RoboGuice but I get null exception. I don't know what is wrong with my codes. @Singleton public class SessionService { p
Solution 1:
When you do new ChannelManager()
, you are not using Guice injection, so your injected fields are null.
To inject your ChannelManager
, either use the @Inject
annotation or use the following code to create your instance:
ChannelManager myChannelManager = RoboGuice.getInjector(this).getInstance(ChannelManager.class);
Post a Comment for "What Is Wrong With Roboguice"