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

com.playtika.testcontainer.memsql.EmbeddedMemSqlDependenciesAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 3.1.9
Show newest version
package com.playtika.testcontainer.memsql;

import com.playtika.testcontainer.common.spring.DependsOnPostProcessor;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

import static com.playtika.testcontainer.memsql.MemSqlProperties.BEAN_NAME_EMBEDDED_MEMSQL;

@AutoConfiguration(afterName = "org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration")
@AutoConfigureOrder
@ConditionalOnClass(DataSource.class)
@ConditionalOnExpression("${embedded.containers.enabled:true}")
@ConditionalOnProperty(name = "embedded.memsql.enabled", matchIfMissing = true)
public class EmbeddedMemSqlDependenciesAutoConfiguration {

    @Configuration
    public static class EmbeddedMemSqlSourceDependencyContext {
        @Bean
        public static BeanFactoryPostProcessor datasourceMemsqlDependencyPostProcessor() {
            return new DependsOnPostProcessor(DataSource.class, new String[]{BEAN_NAME_EMBEDDED_MEMSQL});
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy