大佬教程收集整理的这篇文章主要介绍了Spring Boot 2.1重复reactiveMongoTemplate bean,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
问题AbstractReactiveMongoConfiguration
在于您已经细分了。其reactiveMongoTemplate
@Bean
方法的签名指出它返回ReactiveMongoOperations
。在创建Bean之前,所有可用的类型信息都是如此,并且Bean工厂无法知道该Bean实际上是一个ReactiveMongoTemplate
实例。结果,@ConditionaOnMissingBean
正在寻找的ReactiveMongoTemplate
bean找不到一个,因此尝试定义两个bean。应该在Spring
Data
MongoDB中修复此问题,AbstractReactiveMongoConfiguration
以便为其bean提供尽可能多的类型信息。我已经打开DATAMONGO-2355。
您可以通过更多使用Spring Boot的@R_502_6469@来避免此问题。无需子分类,AbstractReactiveMongoConfiguration
您可以:
spring.data.mongodb.database=mydb
来设置数据库。我有以下Spring Boot @Configuration
类:
@Configuration
@EnableReactiveMongoRepositories
class MongoConfiguration : AbstractReactiveMongoConfiguration()
{
override fun reactiveMongoClient() = MongoClients.create()
override fun getDatabasename() = "mydb"
override fun customcatonversions(): MongoCustomcatonversions =
MongoCustomcatonversions(listOf(ZoneddatetiR_524_11845@eReadConverter(),ZoneddatetiR_524_11845@eWriteConverter()))
}
该应用程序无法启动,并记录以下消息:
这让我感到困惑,因为中的reactiveMongoTemplate
ben方法@H_86_3@mongoReactiveDataAutoConfiguration配置了@ConditionalOnMissingBean
。
以上是大佬教程为你收集整理的Spring Boot 2.1重复reactiveMongoTemplate bean全部内容,希望文章能够帮你解决Spring Boot 2.1重复reactiveMongoTemplate bean所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。