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

com.playtika.testcontainer.cassandra.EmbeddedCassandraDependenciesAutoConfiguration Maven / Gradle / Ivy

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

import com.datastax.oss.driver.api.core.CqlSession;
import com.playtika.testcontainer.common.spring.DependsOnPostProcessor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.AutoConfiguration;
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 static com.playtika.testcontainer.cassandra.CassandraProperties.BEAN_NAME_EMBEDDED_CASSANDRA;

@Slf4j
@AutoConfiguration(afterName = "org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration")
@ConditionalOnClass(CqlSession.class)
@ConditionalOnExpression("${embedded.containers.enabled:true}")
@ConditionalOnProperty(name = "embedded.cassandra.enabled", matchIfMissing = true)
public class EmbeddedCassandraDependenciesAutoConfiguration {

    @Configuration
    public static class CassandraSessionDependencyContextHelper {
        @Bean
        public static BeanFactoryPostProcessor cassandraSessionDependencyPostProcessor() {
            return new DependsOnPostProcessor(CqlSession.class, new String[]{BEAN_NAME_EMBEDDED_CASSANDRA});
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy