001package io.ebean.config;
002
003/**
004 * Provides a ServiceLoader based mechanism to configure a ServerConfig.
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.ServerConfigProvider</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 ServerConfigProvider {
017 *
018 *   @Override
019 *   public void apply(ServerConfig 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 ServerConfigProvider {
031
032  /**
033   * Apply the configuration to the ServerConfig.
034   * <p>
035   * Typically we explicitly register entity bean classes and thus avoid classpath scanning.
036   * </p>
037   */
038  void apply(ServerConfig config);
039}