SpringBoot-data-MongoDB 报错Please use ‘MongoMappingContext#setAutoIndexCreation(boolean)‘
1. 问题原因Spring Data MongoDB 3.x不在提供自动创建索引
> 2021-03-18 15:29:14 |WARN |restartedMain |JustOnceLogger.java:72 |org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexCreator |Automatic index creation will be disabled by default as of Spring Data MongoDB 3.x.Please use 'MongoMappingContext#setAutoIndexCreation(boolean)' or override 'MongoConfigurationSupport#autoIndexCreation()' to be explicit.However, we recommend setting up indices manually in an application ready block. You may use index derivation there as well.> -----------------------------------------------------------------------------------------> @EventListener(ApplicationReadyEvent.class)> public void initIndicesAfterStartup() {>> IndexOperations indexOps = mongoTemplate.indexOps(DomainType.class);>> IndexResolver resolver = new MongoPersistentEntityIndexResolver(mongoMappingContext);> resolver.resolveIndexFor(DomainType.class).forEach(indexOps::ensureIndex);> }> -----------------------------------------------------------------------------------------
2.解决办法:自动创建改为false
spring:data:mongodb:auto-index-creation: false
SpringBoot-data-MongoDB 报错Please use ‘MongoMappingContext#setAutoIndexCreation(boolean)‘相关推荐
- springboot使用redisTemplate 报错:APP FAILED TO START Field template in required a single bean redis工具类
springboot使用redisTemplate 报错: template in com.j.ssm.tool.RedisUtil required a single bean, but 2 wer ...
- springBoot启动类报错
关于SpringBoot启动类报错的问题解决: APPLICATION FAILED TO START Description: Field elasticsearchRestTemplate in ...
- mysql load报错_mysql:执行LOAD DATA LOCAL 报错
mysql:执行LOAD DATA LOCAL 报错. 我使用navicat for mysql 连接 mysql服务器执行local 可以正常执行 . show VARIABLES like '% ...
- SpringBoot 整合Redis报错:NoClassDefFoundError: redis/clients/util/SafeEncoder
QUESTION:SpringBoot 整合Redis报错:NoClassDefFoundError: redis/clients/util/SafeEncoder? ANSWER: 这种情况是版本不 ...
- SpringBoot中@Email报错解决
SpringBoot中@Email报错解决 JSR303校验相关 现象:在springboot中使用@Email注解进行数据校验时,报没有该注解的错误. 解决方法: 在pom.xml中加该配置 < ...
- SpringBoot+MyBatis启动报错java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal
2019独角兽企业重金招聘Python工程师标准>>> 如题,在启动SpringBoot时报SpringBoot+MyBatis启动报错java.lang.NoClassDefFou ...
- mongodb报错:Problem inserting to mongo collection: no reachable servers
文章目录 mongodb报错:Problem inserting to mongo collection: no reachable servers mongodb报错:Problem inserti ...
- springBoot使用RestTemplate报错:No instance available for xxx.xxx.xxx.xxx
springBoot使用RestTemplate报错:No instance available for xxx.xxx.xxx.xxx 解决方案:添加配置类 解决方案:添加配置类 @Configur ...
- 使用next(iter(data.DataLoader())报错StopIteration
使用next(iter(data.DataLoader())报错StopIteration,这是因为当使用next()去访问一个已经迭代完的迭代器时,就会有触发这样的报错:StopIteration, ...
最新文章
- hdu 1255(线段树求重叠面积)
- Windows Azure奇趣应用之Swingify
- 造假暴赚260亿的资本“大忽悠”,终于倒下了
- HDU 5387 Clock(分数类+模拟)
- Eucalyptus EE的介绍及功能说明
- Qt总结之九:QMap中嵌套QList
- 华为鸿蒙系统困难重重,困难重重,华为依然积极发展自主操作系统,同时布局鸿蒙和UOS...
- -lc++ 和 添加 libc++.tbd 居然是等价的
- 微软商店下载的python_Python 登录微软 Win10 应用商店
- 关于计算流体力学,你知道多少?
- 魅族开售跳票,创饥饿营销新高度?
- linux怎么运行cu,Linux cu 命令
- 基于JAVA优乐帮育儿系统计算机毕业设计源码+系统+数据库+lw文档+部署
- LC1143---最长公共子序列
- 深耕MySQL - 如何使用联合索引执行查询
- spring boot oauth2 facebook
- 用CHATGPT做微信视频号和抖音大神,就这几步!
- iPad 上能播放局域网高清片源影音播放利器XBMC使用体会
- 如何制作Excel斜线表头
- CRC-16/MODBUS 校验位计算
热门文章
- MapReduce关系代数运算
- 国内外免费电子书(数学、算法、图像、深度学习、机器学习)
- 【01】什么是AJAX
- 聊聊我对开发项目选技术的看法
- ora-24811提供写入的数据少于指定的数据_C++开源、高性能时序数据库pinusdb
- mysql nosql 同步_使用canal和canal_mysql_nosql_sync同步mysql数据
- linux 一块网卡两个ip,Linux 一块网卡配置多个IP的方法
- java动态语言_java动态类型语言支持(三)
- 计算机管理器win,进入windows启动管理器,win启动管理器
- jsp mysql修改密码_Servlet+JSP+MySQL实现用户管理模块之七、实现用户信息更新和重置密码...