All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.zhengframework.mybatis.MyBatisXmlMultiModule Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
package com.github.zhengframework.mybatis;

import static com.google.inject.name.Names.named;

import com.github.zhengframework.configuration.ConfigurationAwareModule;
import com.github.zhengframework.configuration.ConfigurationBeanMapper;
import java.util.Map;
import java.util.Map.Entry;

public class MyBatisXmlMultiModule extends ConfigurationAwareModule {

  @Override
  protected void configure() {
    Map myBatisConfigMap = ConfigurationBeanMapper
        .resolve(getConfiguration(), MyBatisConfig.class);
    for (Entry entry : myBatisConfigMap.entrySet()) {
      String name = entry.getKey();
      MyBatisConfig myBatisConfig = entry.getValue();
      if (!name.isEmpty()) {
        install(new MyBatisXmlPrivateModule(named(name), myBatisConfig));
      } else {
        install(new MyBatisXmlPrivateModule(null, myBatisConfig));
      }
    }

  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy