You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/asciidoc/data/nosql.adoc
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,7 +145,9 @@ You could take the JPA example from earlier and, assuming that `City` is now a M
145
145
146
146
include::code:CityRepository[]
147
147
148
-
TIP: You can customize document scanning locations by using the `@EntityScan` annotation.
148
+
Repositories and documents are found through scanning.
149
+
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
150
+
You can customize the locations to look for repositories and documents by using `@EnableMongoRepositories` and `@EntityScan` respectively.
149
151
150
152
TIP: For complete details of Spring Data MongoDB, including its rich object mapping technologies, see its {spring-data-mongodb}[reference documentation].
151
153
@@ -220,7 +222,9 @@ The `spring-boot-starter-data-neo4j` "`Starter`" enables the repository support
220
222
Spring Boot supports both classic and reactive Neo4j repositories, using the `Neo4jTemplate` or `ReactiveNeo4jTemplate` beans.
221
223
When Project Reactor is available on the classpath, the reactive style is also auto-configured.
222
224
223
-
You can customize the locations to look for repositories and entities by using `@EnableNeo4jRepositories` and `@EntityScan` respectively on a `@Configuration`-bean.
225
+
Repositories and entities are found through scanning.
226
+
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
227
+
You can customize the locations to look for repositories and entities by using `@EnableNeo4jRepositories` and `@EntityScan` respectively.
224
228
225
229
[NOTE]
226
230
====
@@ -350,6 +354,10 @@ As with the JPA repositories discussed earlier, the basic principle is that quer
350
354
In fact, both Spring Data JPA and Spring Data Elasticsearch share the same common infrastructure.
351
355
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.
352
356
357
+
Repositories and documents are found through scanning.
358
+
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
359
+
You can customize the locations to look for repositories and documents by using `@EnableElasticsearchRepositories` and `@EntityScan` respectively.
360
+
353
361
TIP: For complete details of Spring Data Elasticsearch, see the {spring-data-elasticsearch-docs}[reference documentation].
354
362
355
363
Spring Boot supports both classic and reactive Elasticsearch repositories, using the `ElasticsearchRestTemplate` or `ReactiveElasticsearchTemplate` beans.
@@ -436,6 +444,10 @@ If you add your own `@Bean` of type `CassandraTemplate`, it replaces the default
436
444
Spring Data includes basic repository support for Cassandra.
437
445
Currently, this is more limited than the JPA repositories discussed earlier and needs to annotate finder methods with `@Query`.
438
446
447
+
Repositories and entities are found through scanning.
448
+
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
449
+
You can customize the locations to look for repositories and entities by using `@EnableCassandraRepositories` and `@EntityScan` respectively.
450
+
439
451
TIP: For complete details of Spring Data Cassandra, see the https://docs.spring.io/spring-data/cassandra/docs/[reference documentation].
440
452
441
453
@@ -486,6 +498,11 @@ To take more control, one or more `ClusterEnvironmentBuilderCustomizer` beans ca
486
498
[[data.nosql.couchbase.repositories]]
487
499
==== Spring Data Couchbase Repositories
488
500
Spring Data includes repository support for Couchbase.
501
+
502
+
Repositories and documents are found through scanning.
503
+
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
504
+
You can customize the locations to look for repositories and documents by using `@EnableCouchbaseRepositories` and `@EntityScan` respectively.
505
+
489
506
For complete details of Spring Data Couchbase, see the {spring-data-couchbase-docs}[reference documentation].
490
507
491
508
You can inject an auto-configured `CouchbaseTemplate` instance as you would with any other Spring Bean, provided a `CouchbaseClientFactory` bean is available.
@@ -551,6 +568,11 @@ Make sure to flag your customized `ContextSource` as `@Primary` so that the auto
551
568
[[data.nosql.ldap.repositories]]
552
569
==== Spring Data LDAP Repositories
553
570
Spring Data includes repository support for LDAP.
571
+
572
+
Repositories and documents are found through scanning.
573
+
By default, the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) and all those below it are searched.
574
+
You can customize the locations to look for repositories and documents by using `@EnableLdapRepositories` and `@EntityScan` respectively.
575
+
554
576
For complete details of Spring Data LDAP, see the https://docs.spring.io/spring-data/ldap/docs/1.0.x/reference/html/[reference documentation].
555
577
556
578
You can also inject an auto-configured `LdapTemplate` instance as you would with any other Spring Bean, as shown in the following example:
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/asciidoc/data/sql.adoc
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,6 +218,8 @@ For more complex queries, you can annotate your method with Spring Data's {sprin
218
218
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.
219
219
If you use auto-configuration, repositories are searched from the package containing your main configuration class (the one annotated with `@EnableAutoConfiguration` or `@SpringBootApplication`) down.
220
220
221
+
TIP: You can customize the locations to look for repositories using `@EnableJpaRepositories`.
222
+
221
223
The following example shows a typical Spring Data repository interface definition:
0 commit comments