001package io.ebean.config; 002 003/** 004 * Provides a ServiceLoader based mechanism to configure a DatabaseConfig. 005 * <p> 006 * Provide an implementation and register it via the standard Java ServiceLoader mechanism 007 * via a file at <code>META-INF/services/io.ebean.config.DatabaseConfigProvider</code>. 008 * </p> 009 * <p> 010 * If you are using a DI container like Spring or Guice you are unlikely to use this but instead use a 011 * spring specific configuration. When we are not using a DI container we may use this mechanism to 012 * explicitly register the entity beans and avoid classpath scanning. 013 * </p> 014 * <pre>{@code 015 * 016 * public class EbeanConfigProvider implements DatabaseConfigProvider { 017 * 018 * @Override 019 * public void apply(DatabaseConfig config) { 020 * 021 * // register the entity bean classes explicitly 022 * config.addClass(Customer.class); 023 * config.addClass(User.class); 024 * ... 025 * } 026 * } 027 * 028 * }</pre> 029 */ 030public interface DatabaseConfigProvider { 031 032 /** 033 * Apply the configuration to the DatabaseConfig. 034 * <p> 035 * Typically we explicitly register entity bean classes and thus avoid classpath scanning. 036 * </p> 037 */ 038 void apply(DatabaseConfig config); 039}