All Downloads are FREE. Search and download functionalities are using the official Maven repository.

play.db.ebean.orm.EbeanModule Maven / Gradle / Ivy

/*
 * Copyright (C) 2009-2014 Typesafe Inc. 
 */
package play.db.ebean.orm;

import com.typesafe.config.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import play.Environment;
import play.api.db.evolutions.DynamicEvolutions;
import play.db.ebean.orm.evolution.EvolutionMigration;
import play.inject.Binding;
import play.inject.Module;

import java.util.ArrayList;
import java.util.List;

/**
 * Injection module with default Ebean components.
 *
 * @since 14.11.27
 */
public class EbeanModule extends Module {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public List> bindings(final Environment environment, final Config config) {
        this.logger.trace("Loading module PlayEbean");
        final List> bindings = new ArrayList<>();

        bindings.add(bindClass(DynamicEvolutions.class).to(EbeanDynamicEvolutions.class).eagerly());
        bindings.add(bindClass(EbeanConfig.class).toProvider(DefaultEbeanConfig.EbeanConfigParser.class).eagerly());
        bindings.add(bindClass(EvolutionMigration.class).toSelf().eagerly());
        return bindings;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy