【发布时间】:2019-12-23 23:01:53
【问题描述】:
我正在尝试使用 H2 和 Spring Boot 的反应式存储库。
我添加了依赖项
implementation 'org.springframework.boot.experimental:spring-boot-starter-data-r2dbc:0.1.0.M1'
implementation 'org.springframework.boot.experimental:spring-boot-actuator-autoconfigure-r2dbc:0.1.0.M1'
implementation 'io.r2dbc:r2dbc-pool:0.8.0.RELEASE'
我的域看起来像这样
@Entity
@Table(name = "json_comparison")
public class JsonComparisonResult {
@Column(name = "comparison_id")
@Id
private String comparisonId;
@Column(name = "left")
private String leftSide;
....
何时依赖
implementation "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion"
一切正常。但由于我添加了 r2dbc 依赖项,因此无法找到 javax.persistence 注释的任何依赖项。当我将starter-jpa 与反应式存储库一起使用时,它在启动时失败(常规Reactive Repositories are not supported by JPA)。
如何解决问题?手动添加javax.persistence依赖?
有什么问题?
【问题讨论】:
-
但它说:“JPA 不支持反应式存储库”!?不支持 JPA,因为它不是响应式的
-
我知道。问题是如何修复它,因为 JPA 提供了很多注释。到目前为止,我决定使用来自 Spring 框架库的
data.relational.core.mapping和data.annotation.Id的注释。但是像Enumerated这样的东西没有替代品 -
所以你必须等到 JPA 也变得被动......
-
@SimonMartinelli 我只会玩弄现在存在的东西。当然不是为了生产。
标签: java spring h2 reactive spring-reactive