Поддержка баз данных MyBatis Muti - ошибка с @ com.google.inject.name.Named (value = JDBC.password) уже настроена - PullRequest
0 голосов
/ 06 ноября 2018
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, появляется ошибка ниже.

<b>Root Cause</b></p>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)

...