package org.springnewfiber.dataadapter.config; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.data.mongodb.core.MongoTemplate; /** * 前置mongo库 * @author xiebinbin * @since 2023/5/6 15:10 */ @Configuration @ConfigurationProperties(prefix = "spring.data.mongodb.prefix") public class PrefixMongoConfig extends AbstractMongoConfig{ @Override @Bean(name = "prefixMongoTemplate") public MongoTemplate getMongoTemplate() throws Exception { return new MongoTemplate(mongoDbFactory()); } }