java.lang.Object
io.jooby.ebean.EbeanModule
- All Implemented Interfaces:
Extension
Persistence module using Ebean: https://ebean.io.
{
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).
Properties
Module checks for `ebean.[name]` and `ebean.*` properties (in that order) and creates a DatabaseConfig. Check create(Jooby, String).
- Since:
- 2.6.1
- Author:
- edgar
-
Constructor Summary
ConstructorsConstructorDescriptionCreates 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. -
Method Summary
-
Constructor Details
-
EbeanModule
Creates a new ebean module.- Parameters:
name- Ebean name.
-
EbeanModule
public EbeanModule()Creates a new ebean module using the default name:db. -
EbeanModule
public EbeanModule(@NonNull io.ebean.config.DatabaseConfig config) Creates a module using the provided database configuration.- Parameters:
config- Database configuration.
-
-
Method Details
-
install
-
create
@NonNull public static io.ebean.config.DatabaseConfig create(@NonNull Jooby application, @NonNull String name) Creates a new/default database configuration object from application configuration properties. This method look for ebean properties at:- ebean.[name] - ebean
At look at ebean[.name] and fallbacks to [ebean].
- Parameters:
application- Application.name- Ebean name.- Returns:
- Database configuration.
-