001package io.ebean.config; 002 003import io.ebean.DatabaseFactory; 004 005/** 006 * The configuration used for creating a Database. 007 * <p> 008 * Used to programmatically construct an Database and optionally register it 009 * with the DB singleton. 010 * </p> 011 * <p> 012 * If you just use DB thout this programmatic configuration Ebean will read 013 * the application.properties file and take the configuration from there. This usually 014 * includes searching the class path and automatically registering any entity 015 * classes and listeners etc. 016 * </p> 017 * <pre>{@code 018 * 019 * DatabaseConfig config = new DatabaseConfig(); 020 * 021 * // read the ebean.properties and load 022 * // those settings into this serverConfig object 023 * config.loadFromProperties(); 024 * 025 * // explicitly register the entity beans to avoid classpath scanning 026 * config.addClass(Customer.class); 027 * config.addClass(User.class); 028 * 029 * Database db = DatabaseFactory.create(config); 030 * 031 * }</pre> 032 * 033 * <p> 034 * Note that ServerConfigProvider provides a standard Java ServiceLoader mechanism that can 035 * be used to apply configuration to the DatabaseConfig. 036 * </p> 037 * 038 * @author emcgreal 039 * @author rbygrave 040 * @see DatabaseFactory 041 */ 042public class DatabaseConfig extends ServerConfig { 043 044}