我注意到 mongo 的 Spring 数据中有一些奇怪的东西:
MongoRepositoryextendsCrudRepository并findAll()返回 an ,Iterable该count()方法可以正常使用,因为它返回 a long。
class CrudRepository {
...
Iterable<T> findAll();
long count();
}
在 mongo 中,MongoRepository该findAll()方法返回一个List:
class MongoRepository extends CrudRepository {
...
@Override
List<T> findAll();
}
但是 aList#size()返回 anint并且该MongoRepository#count()方法仍然返回 a long。
当集合超过时会发生什么Integer.MAX_VALUE!?我们还能打电话吗List<T> findAll()?
德玛西亚99
喵喵时光机
开心每一天1111
随时随地看视频慕课网APP
相关分类