orm
jpa
MongoRepository
springboot 整合
- 依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
- springboot扫描注解
@EnableMongoRepositories(
basePackages = {"com.jl.ability.*"},
repositoryImplementationPostfix = "Impl")
repositoryImplementationPostfix 默认就是 Impl 后缀,可指定自定义仓储层接口实现类后缀
如mongodb其CustomizedUserRepository指定实现类customizedUserRepositoryImpl
- 定义接口和自定义接口及实现类
interface CustomizedUserRepository {
void someCu

本文介绍了如何在SpringBoot项目中整合MongoRepository进行ORM操作,详细讲解了依赖配置、接口定义以及CURD的基本操作。同时,文章探讨了如何进行自定义扩展,利用MongoTemplate实现更灵活的数据查询和管理。
最低0.47元/天 解锁文章
236

被折叠的 条评论
为什么被折叠?



