Hi,

I am making a desktop app and trying to use Guice to bind DB
repository, like I would in web app. From what I see, it should work,
but how to configure it?

I have GuiceModule, that looks like that:

public class GuiceModule extends AbstractModule
{
   @Override
   protected void configure()
   {
       // Enable per-request-thread PersistenceManager injection.
       install(new PersistenceManagerFilter.GuiceModule());
       // Business object bindings go here.
       bind(ProjectQueries.class).to(JdoProjectQueries.class);
       bind(new TypeLiteral<Repository<Project>>()
{ }).to(JdoProjectRepository.class);
       }
}

I wanted to just do:

@Inject
        public Repository<Project> projectRepo;

and

projectRepo.persist(newProject);

Of course it throws NPE when I try to do that, because I have nothing
else that would tell it how to find everything. How should I do it?

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

Reply via email to