Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 18 23:22
    whitfin opened #2506
  • Jan 18 20:00
    Xerxekyran commented #2505
  • Jan 18 20:00
    Xerxekyran commented #2505
  • Jan 18 18:37
    jknack commented #2505
  • Jan 18 07:59
    Xerxekyran opened #2505
  • Jan 17 00:27
    dependabot[bot] labeled #2504
  • Jan 17 00:27
    dependabot[bot] labeled #2504
  • Jan 17 00:27
    dependabot[bot] opened #2504
  • Jan 17 00:27

    dependabot[bot] on npm_and_yarn

    Bump graphql from 15.5.0 to 16.… (compare)

  • Jan 17 00:27
    dependabot[bot] labeled #2503
  • Jan 17 00:27
    dependabot[bot] labeled #2503
  • Jan 17 00:27
    dependabot[bot] opened #2503
  • Jan 17 00:27

    dependabot[bot] on npm_and_yarn

    Bump react and react-dom in /mo… (compare)

  • Jan 17 00:07
    dependabot[bot] labeled #2502
  • Jan 17 00:07
    dependabot[bot] labeled #2502
  • Jan 17 00:07
    dependabot[bot] opened #2502
  • Jan 17 00:07

    dependabot[bot] on maven

    Bump asciidoctorj from 2.5.1 to… (compare)

  • Jan 16 17:49

    jknack on gh-pages

    Delete CNAME (compare)

  • Jan 16 17:43
    jknack closed #2444
  • Jan 16 17:42
    jknack milestoned #2444
Edgar Espina
@jknack
no custom Server implementation
Mészáros István
@imeszaros
cool
that makes it clear
let me know if I can assist at any point
Edgar Espina
@jknack
cool
Edgar Espina
@jknack
Nguyen Huu Tuan
@snowyukischnee
hi, how can i using jooby hibernate with multiple datasource?
Edgar Espina
@jknack
multiple hibernate instances?
{
   install(new HibernateModule(“db.first"));
   install(new HibernateModule(“db.second"));
}
The keys db.first and db.second must be configuration prooperties
then you can request or inject one or the other by:
require(EntityManager.class, “db.first”);
or inject:
@Inject
public MyRepo(@Named(“db.first”) EntityManager em)
Edgar Espina
@jknack
@reddierocket https://github.com/jooby-project/jooby/pull/2078/files will be available in next release
Nguyen Huu Tuan
@snowyukischnee
@jknack i've done configure hibernate with multiple datasources.
however the @Inject seems not work when I inject EntityManager into mvc router
Edgar Espina
@jknack
what is the error?
Nguyen Huu Tuan
@snowyukischnee
it throws NPE
Nguyen Huu Tuan
@snowyukischnee
oh i forgot
Edgar Espina
@jknack
you need two
one for each datasourcce
decorator(new TransactionalRequest(“db.first"));
Nguyen Huu Tuan
@snowyukischnee
How can I inject some class instance using GuiceModule?
Edgar Espina
@jknack
Hmm?
Nguyen Huu Tuan
@snowyukischnee
I've created a class which extends AbstractModule and put it in
install(new GuiceModule(new MyModule()))
class MyModule {
  configure() {
    bind(Repo.class).to(Impl.class);
  }
}
and I'm inject Repo.class into the mvc router, and it also throws NPE
Edgar Espina
@jknack
show me the controller
it should works that is plain Guice
Nguyen Huu Tuan
@snowyukischnee
class Router {
  @Inject
  Repo repo;

  @Path("test")
  @GET 
  String test() {
    repo.save(new TestObj());
    return "Hello";
  }
}
Edgar Espina
@jknack
show me your App where did you add the Router
Nguyen Huu Tuan
@snowyukischnee
class Repo {
  @Inject
  @Named("db.first")
  EntityManager em;

  public void save(TestObj obj) {
    em.persist(obj);
  }
}
Edgar Espina
@jknack
show me your App where did you add the Router
Nguyen Huu Tuan
@snowyukischnee
{
  mount(new RouterDef());
}
class RouterDef extends Jooby {
  {
    mvc(new Router());
  }
}
Edgar Espina
@jknack
That is wrong
Nguyen Huu Tuan
@snowyukischnee
what should i do?
Edgar Espina
@jknack
class RouterDef extends Jooby {
  {
    mvc(Router.class);
  }
}
you need to let Guice to give you an instance of Router
Nguyen Huu Tuan
@snowyukischnee
oh
Edgar Espina
@jknack
is you created an instance manually, you will get null for any dep
Nguyen Huu Tuan
@snowyukischnee
oh i see
thanks
Edgar Espina
@jknack
cool
Nguyen Huu Tuan
@snowyukischnee

@jknack
if i define the routes and mount it using mount(), then this will not works, it throws io.jooby.exception.RegistryException: Service not found

class RouterDef extends Jooby {
  {
    mvc(Router.class);
  }
}
{
  install(new GuiceModule());
  mount(new RouterDef());
}

but this works

  {
    install(new GuiceModule());
    mvc(Router.class);
  }
Nguyen Huu Tuan
@snowyukischnee
does di was not work under mount() ?
Nguyen Huu Tuan
@snowyukischnee
and, how can i use guice injection with decorator?
Pascal Le Merrer
@PascalLeMerrer
Hi. I'm new to Jooby, it looks very promising. The home page content however looks like it was spammed with links without interest.
Mészáros István
@imeszaros
@PascalLeMerrer use https://jooby.io/ instead of jooby.org.
the latter was taken over by a stranger and Edgar was unable to get it back from the provider unfortunately