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

com.jeromeloisel.repository.elasticsearch.starter.ElasticSearchRepositoryFactoryAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 5.6.3
Show newest version
package com.jeromeloisel.repository.elasticsearch.starter;

import org.elasticsearch.client.Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.jeromeloisel.db.conversion.api.JsonSerializationFactory;
import com.jeromeloisel.db.repository.api.DatabaseRepositoryFactory;
import com.jeromeloisel.db.repository.elasticsearch.ElasticSearchRepositoryFactory;

/**
 * Elasticsearch Repository autoconfiguration.
 * 
 * @author jerome
 *
 */
@Configuration
public class ElasticSearchRepositoryFactoryAutoConfiguration {

  @Bean
  @Autowired
  @ConditionalOnMissingBean(DatabaseRepositoryFactory.class)
  @ConditionalOnBean(value={Client.class, JsonSerializationFactory.class})
  DatabaseRepositoryFactory databaseRepositoryFactory(
      final Client client,
      final JsonSerializationFactory serialization) {
    return new ElasticSearchRepositoryFactory(serialization, client);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy