我在MongoDB数据库中有一个名为
我希望使用外部配置将其配置为查找
Products
的集合,它在我的Java代码中由接口IProductPrice
表示。下面的存储库声明会导致Spring Date查找db.collection: Intelliprice.iProductPrice
集合。我希望使用外部配置将其配置为查找
db.collection: Intelliprice.Products
而不是在IProductPrice
上放置@Collection(..)
注释。这是否可行?我该如何做到这一点?public interface ProductsRepository extends
MongoRepository<IProductPrice, String> {
}
ReactiveMongoRepository<iProductPrice,String>
中声明,则即使硬编码的集合名称为@Document(collection = "specific_collection_name")
,也会被忽略。集合将是iproductprice
。 - Zon