mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '3.1.x'
Closes gh-36863
This commit is contained in:
commit
94d6ccd7a5
@ -200,7 +200,9 @@ You could take the JPA example from earlier and, assuming that `City` is now a M
|
||||
|
||||
include::code:CityRepository[]
|
||||
|
||||
TIP: You can customize document scanning locations by using the `@EntityScan` annotation.
|
||||
Repositories and documents are found through scanning.
|
||||
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
|
||||
You can customize the locations to look for repositories and documents by using `@EnableMongoRepositories` and `@EntityScan` respectively.
|
||||
|
||||
TIP: For complete details of Spring Data MongoDB, including its rich object mapping technologies, see its {spring-data-mongodb}[reference documentation].
|
||||
|
||||
@ -254,7 +256,9 @@ The `spring-boot-starter-data-neo4j` "`Starter`" enables the repository support
|
||||
Spring Boot supports both classic and reactive Neo4j repositories, using the `Neo4jTemplate` or `ReactiveNeo4jTemplate` beans.
|
||||
When Project Reactor is available on the classpath, the reactive style is also auto-configured.
|
||||
|
||||
You can customize the locations to look for repositories and entities by using `@EnableNeo4jRepositories` and `@EntityScan` respectively on a `@Configuration`-bean.
|
||||
Repositories and entities are found through scanning.
|
||||
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
|
||||
You can customize the locations to look for repositories and entities by using `@EnableNeo4jRepositories` and `@EntityScan` respectively.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
@ -364,6 +368,10 @@ As with the JPA repositories discussed earlier, the basic principle is that quer
|
||||
In fact, both Spring Data JPA and Spring Data Elasticsearch share the same common infrastructure.
|
||||
You could take the JPA example from earlier and, assuming that `City` is now an Elasticsearch `@Document` class rather than a JPA `@Entity`, it works in the same way.
|
||||
|
||||
Repositories and documents are found through scanning.
|
||||
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
|
||||
You can customize the locations to look for repositories and documents by using `@EnableElasticsearchRepositories` and `@EntityScan` respectively.
|
||||
|
||||
TIP: For complete details of Spring Data Elasticsearch, see the {spring-data-elasticsearch-docs}[reference documentation].
|
||||
|
||||
Spring Boot supports both classic and reactive Elasticsearch repositories, using the `ElasticsearchRestTemplate` or `ReactiveElasticsearchTemplate` beans.
|
||||
@ -475,6 +483,10 @@ If you add your own `@Bean` of type `CassandraTemplate`, it replaces the default
|
||||
Spring Data includes basic repository support for Cassandra.
|
||||
Currently, this is more limited than the JPA repositories discussed earlier and needs `@Query` annotated finder methods.
|
||||
|
||||
Repositories and entities are found through scanning.
|
||||
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
|
||||
You can customize the locations to look for repositories and entities by using `@EnableCassandraRepositories` and `@EntityScan` respectively.
|
||||
|
||||
TIP: For complete details of Spring Data Cassandra, see the https://docs.spring.io/spring-data/cassandra/docs/[reference documentation].
|
||||
|
||||
|
||||
@ -524,6 +536,11 @@ To take more control, one or more `ClusterEnvironmentBuilderCustomizer` beans ca
|
||||
[[data.nosql.couchbase.repositories]]
|
||||
==== Spring Data Couchbase Repositories
|
||||
Spring Data includes repository support for Couchbase.
|
||||
|
||||
Repositories and documents are found through scanning.
|
||||
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
|
||||
You can customize the locations to look for repositories and documents by using `@EnableCouchbaseRepositories` and `@EntityScan` respectively.
|
||||
|
||||
For complete details of Spring Data Couchbase, see the {spring-data-couchbase-docs}[reference documentation].
|
||||
|
||||
You can inject an auto-configured `CouchbaseTemplate` instance as you would with any other Spring Bean, provided a `CouchbaseClientFactory` bean is available.
|
||||
@ -589,6 +606,11 @@ Make sure to flag your customized `ContextSource` as `@Primary` so that the auto
|
||||
[[data.nosql.ldap.repositories]]
|
||||
==== Spring Data LDAP Repositories
|
||||
Spring Data includes repository support for LDAP.
|
||||
|
||||
Repositories and documents are found through scanning.
|
||||
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
|
||||
You can customize the locations to look for repositories and documents by using `@EnableLdapRepositories` and `@EntityScan` respectively.
|
||||
|
||||
For complete details of Spring Data LDAP, see the https://docs.spring.io/spring-data/ldap/docs/1.0.x/reference/html/[reference documentation].
|
||||
|
||||
You can also inject an auto-configured `LdapTemplate` instance as you would with any other Spring Bean, as shown in the following example:
|
||||
|
@ -229,6 +229,8 @@ For more complex queries, you can annotate your method with Spring Data's {sprin
|
||||
Spring Data repositories usually extend from the {spring-data-commons-api}/repository/Repository.html[`Repository`] or {spring-data-commons-api}/repository/CrudRepository.html[`CrudRepository`] interfaces.
|
||||
If you use auto-configuration, repositories are searched from the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) down.
|
||||
|
||||
TIP: You can customize the locations to look for repositories using `@EnableJpaRepositories`.
|
||||
|
||||
The following example shows a typical Spring Data repository interface definition:
|
||||
|
||||
include::code:CityRepository[]
|
||||
|
Loading…
Reference in New Issue
Block a user