package org.springnewfiber.dataadapter.config; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.SimpleMongoClientDatabaseFactory; /** * mongo配置类 * @author xiebinbin * @since 2023/5/6 14:59 */ public abstract class AbstractMongoConfig { private String uri; /** * 获取mongoDBTtemplate对象 */ public abstract MongoTemplate getMongoTemplate() throws Exception; /** * 创建mongoDb工厂 */ public SimpleMongoClientDatabaseFactory mongoDbFactory() throws Exception { return new SimpleMongoClientDatabaseFactory(uri); } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } }