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 {
vo