Spring Data JPA底层机制未实现 [英] Spring Data JPA underlying mechanism without implementation

查看:25
本文介绍了Spring Data JPA底层机制未实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始阅读这个教程:spring boot教程

在这篇文章中,我读到在模型模块下他们实现了 POJO 和存储库接口.-> github 上的教程

In this I read that under model module they implemented POJOs and Repository interfaces. -> tutorial on github

在 Repository 接口中,我发现了两种没有实现的方法:按用户名查找,findByAccountUsername.

In Repository interfaces I found two methods without implementations: findByUsername, findByAccountUsername.

我的问题是:

  1. 当存储库接口中的那些方法没有时它是如何工作的实现和那些不是从任何超类继承的?
  2. 它是否适用于命名约定和反射?
  3. Spring Data 是否有可以使用的内存数据库?

推荐答案

(1)当存储库接口中的那些方法有时它是如何工作的没有实现,并且没有从任何超类继承?

(1) How does it work when those methods in repository interfaces have no implementations and those are not inherited from any super class?

Repository 接口在运行时由 Spring Container 实现(备份).

The Repository interfaces are being implemented (backed up) by Spring Container at Runtime.

(2) 它是否适用于命名约定和反射?

(2) Does it work with name conventions and reflections?

是的,它适用于命名约定,并且 spring 容器使用 JDK 的代理类来拦截对 Repository 的调用.

Yes, it works on naming conventions and spring container uses JDK's proxy classes to intercept the calls to the Repository.

(3) Spring Data 有内存数据库可以使用吗?

(3) Does Spring Data has inmemory database to work with?

不,Spring 不使用任何内存数据库

No, Spring does not use any inmemory database

更详细的解释请参考以下链接:

Please refer the below link for more detailed explanation:

Spring Data 存储库实际是如何实现的?

这篇关于Spring Data JPA底层机制未实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆