mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Upgrade to Spring Data Evans
The missing bean condition on the auto-configuration classes for Elasticsearch, Jpa, Mongo and Solr repositories have been tightened to look for ElasticsearchRepositoryFactoryBean, JapRepositoryFactoryBean, MonoRepositoryFactoryBean, and SolrRepositoryFactoryBean respectively. In Spring Data Evans, when there are multiple repository types on the classpath, a strict mode is entered to prevent the different repositories from trampling over each other. A side-effect of this is that for the Mongo domain types in the tests to be discovered they must be explicitly annotated with @Document. Closes gh-1338
This commit is contained in:
parent
dde7ebf30f
commit
fbeb8c966c
@ -25,7 +25,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
|
||||
import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data's Elasticsearch
|
||||
@ -39,7 +39,7 @@ import org.springframework.data.repository.core.support.RepositoryFactoryBeanSup
|
||||
@Configuration
|
||||
@ConditionalOnClass({ Client.class, ElasticsearchRepository.class })
|
||||
@ConditionalOnProperty(prefix = "spring.data.elasticsearch.repositories", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnMissingBean(RepositoryFactoryBeanSupport.class)
|
||||
@ConditionalOnMissingBean(ElasticsearchRepositoryFactoryBean.class)
|
||||
@Import(ElasticsearchRepositoriesAutoConfigureRegistrar.class)
|
||||
public class ElasticsearchRepositoriesAutoConfiguration {
|
||||
|
||||
|
@ -31,7 +31,7 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
|
||||
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
|
||||
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
|
||||
import org.springframework.data.web.config.EnableSpringDataWebSupport;
|
||||
|
||||
@ -57,7 +57,7 @@ import org.springframework.data.web.config.EnableSpringDataWebSupport;
|
||||
@Configuration
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
@ConditionalOnClass(JpaRepository.class)
|
||||
@ConditionalOnMissingBean({ RepositoryFactoryBeanSupport.class,
|
||||
@ConditionalOnMissingBean({ JpaRepositoryFactoryBean.class,
|
||||
JpaRepositoryConfigExtension.class })
|
||||
@ConditionalOnProperty(prefix = "spring.data.jpa.repositories", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@Import(JpaRepositoriesAutoConfigureRegistrar.class)
|
||||
|
@ -27,7 +27,7 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
import org.springframework.data.mongodb.repository.config.MongoRepositoryConfigurationExtension;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
|
||||
import org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean;
|
||||
|
||||
import com.mongodb.Mongo;
|
||||
|
||||
@ -54,7 +54,7 @@ import com.mongodb.Mongo;
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ Mongo.class, MongoRepository.class })
|
||||
@ConditionalOnMissingBean({ RepositoryFactoryBeanSupport.class,
|
||||
@ConditionalOnMissingBean({ MongoRepositoryFactoryBean.class,
|
||||
MongoRepositoryConfigurationExtension.class })
|
||||
@ConditionalOnProperty(prefix = "spring.data.mongo.repositories", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@Import(MongoRepositoriesAutoConfigureRegistrar.class)
|
||||
|
@ -22,9 +22,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport;
|
||||
import org.springframework.data.solr.repository.SolrRepository;
|
||||
import org.springframework.data.solr.repository.config.SolrRepositoryConfigExtension;
|
||||
import org.springframework.data.solr.repository.support.SolrRepositoryFactoryBean;
|
||||
|
||||
/**
|
||||
* Enables auto configuration for Spring Data Solr repositories.
|
||||
@ -45,7 +45,7 @@ import org.springframework.data.solr.repository.config.SolrRepositoryConfigExten
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ SolrServer.class, SolrRepository.class })
|
||||
@ConditionalOnMissingBean({ RepositoryFactoryBeanSupport.class,
|
||||
@ConditionalOnMissingBean({ SolrRepositoryFactoryBean.class,
|
||||
SolrRepositoryConfigExtension.class })
|
||||
@ConditionalOnProperty(prefix = "spring.data.solr.repositories", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@Import(SolrRepositoriesAutoConfigureRegistrar.class)
|
||||
|
@ -19,11 +19,12 @@ package org.springframework.boot.autoconfigure.data.mongo.city;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
@Document
|
||||
public class City implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -19,11 +19,12 @@ package org.springframework.boot.autoconfigure.data.mongo.country;
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
@Document
|
||||
public class Country implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -107,7 +107,7 @@
|
||||
<spring-amqp.version>1.4.0.M1</spring-amqp.version>
|
||||
<spring-cloud.version>1.1.0.RELEASE</spring-cloud.version>
|
||||
<spring-batch.version>3.0.1.RELEASE</spring-batch.version>
|
||||
<spring-data-releasetrain.version>Dijkstra-SR4</spring-data-releasetrain.version>
|
||||
<spring-data-releasetrain.version>Evans-RELEASE</spring-data-releasetrain.version>
|
||||
<spring-hateoas.version>0.16.0.RELEASE</spring-hateoas.version>
|
||||
<spring-integration.version>4.1.0.M1</spring-integration.version>
|
||||
<spring-loaded.version>1.2.0.RELEASE</spring-loaded.version>
|
||||
|
Loading…
Reference in New Issue
Block a user