Class ServerConfig

  • @Deprecated
    public class ServerConfig
    extends DatabaseConfig
    Deprecated - please migrate to io.ebean.DatabaseConfig. The configuration used for creating a Database.

    Used to programmatically construct a Database and optionally register it with the DB singleton.

    If you just use DB without this programmatic configuration DB will read the file and take the configuration from there. This usually includes searching the class path and automatically registering any entity classes and listeners etc.

     ServerConfig config = new ServerConfig();
     // read the and load
     // those settings into this serverConfig object
     // explicitly register the entity beans to avoid classpath scanning
     Database database = DatabaseFactory.create(config);

    Note that ServerConfigProvider provides a standard Java ServiceLoader mechanism that can be used to apply configuration to the ServerConfig.

    emcgreal, rbygrave
    See Also: