Google Guice - no implementation was bound error

11,071 views
Skip to first unread message

pbartosz

unread,
Jun 19, 2010, 12:52:36 PM6/19/10
to google-guice
I'm trying to use Google Guice.
In a simple code i get an error:

No implementation for pl.edu.agh.logger.IMessageSerializer was bound.
while locating pl.edu.agh.logger.IMessageSerializer
for parameter 0 at pl.edu.agh.logger.Logger.<init>(Logger.java:26)
while locating pl.edu.agh.logger.Logger

What is it caused by?

public class Logger {
...
@Inject
public Logger(IMessageSerializer messageSerializer) {
registeredSerializers = new HashSet<IMessageSerializer>();
registeredSerializers.add(messageSerializer);
dateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
}
...
}

public class SchoolModule extends AbstractModule{
@Override
protected void configure(){
bind(IMessageSerializer.class).to(FileMessageSerializer.class);
}
}

yaniv kessler

unread,
Jun 20, 2010, 7:20:55 AM6/20/10
to google...@googlegroups.com
did you add SchoolModule to the injector?

Guice.createInjector(new SchoolModule()); 


--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.


pbartosz

unread,
Jun 21, 2010, 3:50:16 PM6/21/10
to google-guice
No, I didn't.
Thanks!
Reply all
Reply to author
Forward
0 new messages