public class EbeanModule extends Object implements Extension
{
install(new HikariModule());
install(new EbeanModule());
get("/", ctx -> {
Database db = require(Database.class);
...
});
}
We do recommend the use of Hikari as connection pool, so make sure the hikari module is in your
project dependencies.
Ebean depends on an annotation processor to do byte code enhancements. Please check
https://ebean.io/docs/getting-started/maven for maven setup and
https://ebean.io/docs/getting-started/gradle for gradle setup.
The module integrates Ebean with Jooby application properties and service registry (require
calls or DI framework).
Module checks for `ebean.[name]` and `ebean.*` properties (in that order) and creates a
DatabaseConfig. Check create(Jooby, String).
| Constructor and Description |
|---|
EbeanModule()
Creates a new ebean module using the default name:
db. |
EbeanModule(io.ebean.config.DatabaseConfig config)
Creates a module using the provided database configuration.
|
EbeanModule(String name)
Creates a new ebean module.
|
| Modifier and Type | Method and Description |
|---|---|
static io.ebean.config.DatabaseConfig |
create(Jooby application,
String name)
Creates a new/default database configuration object from application configuration properties.
|
void |
install(Jooby application) |
public EbeanModule(@Nonnull String name)
name - Ebean name.public EbeanModule()
db.public EbeanModule(@Nonnull io.ebean.config.DatabaseConfig config)
config - Database configuration.@Nonnull public static io.ebean.config.DatabaseConfig create(@Nonnull Jooby application, @Nonnull String name)
application - Application.name - Ebean name.Copyright © 2020. All rights reserved.