MyBatis Muti数据库支持-@ com.google.inject.name.Named(value = JDBC.password)的错误已配置

时间:2018-11-06 00:49:23

标签: guice mybatis

Here is my pseudo code Snippet 

Application.java{
 Injector injector = Guice.createInjector(new UserModule(),new AdminModule());
        guiceBridge.bridgeGuiceInjector(injector);
}

public class UserModule extends AbstractModule {

//Override Config
//install(new MyBatisModule() {

        @Override
        protected void initialize() {
}
Code as per http://www.mybatis.org/guice/core.html
install(JdbcHelper.MySQL)
}

公共类AdminModule扩展了AbstractModule {

//Override Config
//install(new MyBatisModule() {

        @Override
        protected void initialize() {
}
Code as per http://www.mybatis.org/guice/core.html
install(JdbcHelper.SQL_Server_2005_MS_Driver)
}

运行API时,出现以下错误。

Root Cause

com.google.inject.CreationException: Unable to create injector, see the following errors: 1) A binding to java.lang.String annotated with @com.google.inject.name.Named(value=JDBC.password) was already configured at com.birst.provisioning.UserModule$1.initialize(UserModule.java:149) (via modules: com.birst.provisioning.UserModule -> com.birst.provisioning.UserModule$1). at com.birst.provisioning.AdminModule$1.initialize(AdminModule.java:89) (via modules: com.birst.provisioning.AdminModule -> com.birst.provisioning.AdminModule$1) 2) A binding to java.lang.String annotated with @com.google.inject.name.Named(value=mybatis.environment.id) was already configured at com.birst.provisioning.UserModule$1.initialize(UserModule.java:149) (via modules: com.birst.provisioning.UserModule -> com.birst.provisioning.UserModule$1). at com.birst.provisioning.AdminModule$1.initialize(AdminModule.java:89) (via modules: com.birst.provisioning.AdminModule -> com.birst.provisioning.AdminModule$1)

0 个答案:

没有答案