@SuppressWarnings("rawtypes")
@Override
public NoSqlEntityManagerFactory createInstance(DbTypeEnum type, Map<String, Object> properties, Map<Class, Converter> converters, ClassLoader cl2) {
Object spiImpl = properties.get(Bootstrap.SPI_IMPL);
NoSqlRawSession temp = null;
if(spiImpl != null && spiImpl instanceof NoSqlRawSession) {
temp = (NoSqlRawSession) spiImpl;
}
Injector injector = Guice.createInjector(new ProductionBindings(type, temp));
NoSqlEntityManagerFactory factory = injector.getInstance(NoSqlEntityManagerFactory.class);
Named named = Names.named("logger");
Key<NoSqlRawSession> key = Key.get(NoSqlRawSession.class, named);
NoSqlRawSession inst = injector.getInstance(key);
inst.start(properties);
//why not just add setInjector() and setup() in NoSqlEntityManagerFactory
BaseEntityManagerFactoryImpl impl = (BaseEntityManagerFactoryImpl)factory;
impl.setInjector(injector);