java - 将 Spring Boot 与 EBean 和 HikariCP 连接池集成

标签 java spring spring-boot ebean hikaricp

EBean 是一种无状态的 ORM。 http://ebean-orm.github.io/

EBean 提供了一个 Spring Boot 工件。 http://ebean-orm.github.io/docs/setup/spring#spring-boot https://github.com/ebean-orm/avaje-ebeanorm-spring

但在那种情况下,EBean 会直接读取 jdbc 连接详细信息,如下所示。

ebean.db.ddl.generate=true
ebean.db.ddl.run=true

datasource.db.username=sa
datasource.db.password=
datasource.db.databaseUrl=jdbc:h2:mem:tests
datasource.db.databaseDriver=org.h2.Driver

我想利用我现有的 HikariCP 数据源与 Spring Boot 和 EBean。

我们如何做到这一点?

最佳答案

您可以在此处查看工作中的 EBean + Spring Boot 示例:

https://github.com/bwajtr/java-persistence-frameworks-comparison

在该存储库中,这里有 SpringBoot 配置:https://github.com/bwajtr/java-persistence-frameworks-comparison/blob/master/src/main/java/com/clevergang/dbtests/DbTestsApplication.java

在该类中,您可以看到 EBean 是如何配置的以及 DataSource 是如何连接到它的 -> 事实上,您可以使用任何实现 DataSource 接口(interface)的东西,包括 HikariCP ...所以使用 DbTestsApplication 中的 EBean 配置并为 SpringBoot 设置 HikariCP (在这里查看操作方法:How do I configure HikariCP in my Spring Boot app in my application.properties files?)

关于java - 将 Spring Boot 与 EBean 和 HikariCP 连接池集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38496155/

相关文章:

java - 使用 java/postgres 的预定报告

java - 错误: XHR failed loading: GET "http://localhost:8080/home" in agular

java - 使用 Spring Security 的 session 属性

spring - 带有 Proxypass 和 Spring Security 的 Apache

java - 7Zip 无法解压缩由 Oracle 11g DB 中的 JAVA 源创建的文件

java - 我的 JPanel 没有按我想要的方式显示

java - 由于 org.eclipse.core.runtime 无法启动 eclipse

spring - 如何从 SOAP CXF web.xml 配置迁移到 Spring-Boot?

hibernate - 为什么带有@EmbeddedId的实体不能在对应的@Embeddable类中使用LocalDateTime?

java - 在 NAS 上移动文件时出现 AccessDeniedException