Spring Data Document with MongoDB Support 1.0.0.M3是 Spring Data 早期针对 MongoDB 发布的里程碑版本(Milestone 3),发布于2011 年。它是Spring Data MongoDB 项目的前身,从1.0.0.M4版本起,项目正式更名为Spring Data MongoDB。
一、版本背景与定位
- 项目原名:Spring Data Document (代号DATADOC)
- 核心目标:为 Spring 开发者提供基于文档型数据库(当时主要是 MongoDB)的统一数据访问抽象。
- 版本状态:早期开发里程碑(非稳定版),用于预览功能与收集反馈。
- 关键更名:M3 是最后一个以 “Spring Data Document” 命名的版本;M4 起更名为 Spring Data MongoDB,包路径也从
org.springframework.data.document.mongodb改为org.springframework.data.mongodb。
二、核心新特性(相对于 M2)
重构 MongoTemplate 构造函数
- 移除旧构造器:
MongoTemplate(Mongo, String, String) - 引入新构造器:
MongoTemplate(MongoDbFactory)、MongoTemplate(Mongo, String, UserCredentials) - 目的:简化工厂模式、统一认证与数据源配置。
- 移除旧构造器:
增强 Repository 编程模型
- 完善基于接口的CRUD Repository自动实现。
- 支持通过方法名解析查询(如
findByLastName())。
对象映射(Mapping)优化
- 强化POJO 与 MongoDB BSON 文档的转换能力。
- 支持
@Document,@Id,@Field等核心注解。
基础操作完善
- 支持完整的增删改查(CRUD)、批量操作、原子
findAndModify。 - 支持更新修饰符(Update Modifiers),实现文档部分更新。
- 异常转译:将 MongoDB 原生异常转为 SpringDataAccessException层次结构。
- 支持完整的增删改查(CRUD)、批量操作、原子
三、技术依赖
- MongoDB Java Driver:2.5.3 ~ 2.6.5
- Spring Framework: 3.0.x 系列
- Spring Data Commons: 1.2.x 系列
四、Maven 依赖坐标
<!-- 注意:需添加 Spring Milestone 仓库 --><repositories><repository><id>spring-milestone</id><url>http://repo.spring.io/milestone</url></repository></repositories><dependency><groupId>org.springframework.data</groupId><artifactId>spring-data-document-mongodb</artifactId><version>1.0.0.M3</version></dependency><dependency><groupId>org.mongodb</groupId><artifactId>mongo-java-driver</artifactId><version>2.5.3</version></dependency>五、历史意义
此版本是Spring 生态进军 NoSQL的关键里程碑,奠定了后续 Spring Data MongoDB 简化开发的基石。虽然 API 已过时,但它确立的Template 模式与Repository 抽象,至今仍是 Spring Data 家族的核心设计思想。
总结:1.0.0.M3 是 Spring Data MongoDB 的历史起点。现代开发应直接使用Spring Data MongoDB 4.x+稳定版。
Spring Data Document with MongoDB Support 1.0.0.M3 Released
I am pleased to announce that the Milestone 3 release of the Spring Data Document 1.0 project with MongoDB support is now available!
The primary goal of the Spring Data project is to make it easier to build Spring-powered applications that use new data access technologies such as non-relational databases, map-reduce frameworks, and cloud based data services.
The MongoDB module provides integration with the MongoDB document database.
Downloads | JavaDocs | Reference Documentation | Changelog
To learn more about the project, visit the Spring Data MongoDB Page.
The changes and new features in Spring Data Document 1.0.0.M3 includes much improved mapping and conversion support. The MappingMongoConverter is now the default converter used by the MongoTemplate and the SimpleMongoConverter has been deprecated and will be removed. The concept of a default collection name has also been removed and all operations of the MongoTemplate are based on the collection name used for the entity class that is the target of the operation. The collection name used for an entity class defaults to the clasname starting with a lower-case letter but it can be customized using the @Document annotation. See the changelog for more details.
Looking forward to your feedback on the forum or in the issue tracker.
comments powered by Disqus