@Override
public void run(T configuration, io.dropwizard.setup.Environment environment) throws Exception {
ManagedDataSource fooDataSource = buildFooDataSource(configuration, environment);
ManagedDataSource barDataSource = buildBarDataSource(configuration, environment);
environment.lifecycle().manage(fooDataSource);
environment.lifecycle().manage(barDataSource);
fooSqlSessionFactory = createSqlSessionFactory(fooDataSource);
barSqlSessionFactory = createSqlSessionFactory(barDataSource);
environment.healthChecks().register("foo", new SqlSessionFactoryHealthCheck(fooSqlSessionFactory));
environment.jersey().register(SqlSessionProvider.binder(fooSqlSessionFactory));
environment.healthChecks().register("bar", new SqlSessionFactoryHealthCheck(barSqlSessionFactory));
environment.jersey().register(SqlSessionProvider.binder(barSqlSessionFactory));
}
Basically I had just copied lines I found for one DB/SqlSessionfactory for the other.
Now I get an error/warning after the 2nd environment.jersey().register is executed:
WARN [2016-01-21 19:37:55,529] org.glassfish.jersey.internal.Errors: The following warnings have been detected: WARNING: Cannot create new registration for component type class com.loginbox.dropwizard.mybatis.providers.SqlSessionProvider$Binder: Existing previous registration found for the type.
I'm pretty clueless here, what do I need to register and how?
Thanks, Jason
Hmm,
That was a while back, I don't recall what the solution was.
However, I was able to create two database connections with
mybatis in the end.
Jason
-- You received this message because you are subscribed to a topic in the Google Groups "dropwizard-user" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/dropwizard-user/tQzwQUfcNTE/unsubscribe. To unsubscribe from this group and all its topics, send an email to dropwizard-us...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.