Skip to content

mlk/jdbi-guice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov.io

jdbi-guice

A module to marry together JDBI bound resources to the Guice dependency injection framework.

Injector injector = Guice.createInjector(JdbiModule.builder().scan("com.github.mlk.guice.dao").build(),
                new AbstractModule() {
                    @Override
                    protected void configure() {
                        bind(DBI.class).toInstance(new DBI("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1"));
                    }
                });
        MyDAO myDAO = injector.getInstance(MyDAO.class);

        myDAO.createSomethingTable();
        myDAO.insert(1, "fred");
        System.out.println(myDAO.findNameById(1));

It is on Maven, so use it with:

<dependency>
  <groupId>com.github.mlk</groupId>
  <artifactId>jdbi-guice</artifactId>
  <version>1.0.0</version>
</dependency>

About

A module to marry together JDBI bound resources to the Guice dependency injection framework.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages