mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-27 20:49:34 +00:00
Introduce spring-boot-persistence
This commit adds a spring-boot-persistence module with data technology independent features. This provides a better home for EntityScan and PersistenceExceptionTranslationAutoConfiguration. Closes gh-45328
This commit is contained in:
+1
-1
@@ -176,7 +176,7 @@ For more about Spring Data, see the {url-spring-data-site}[Spring Data project p
|
||||
== Separate @Entity Definitions from Spring Configuration
|
||||
|
||||
Spring Boot determines the location of your javadoc:jakarta.persistence.Entity[format=annotation] definitions by scanning the xref:reference:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages].
|
||||
For more control, use the javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] annotation, as shown in the following example:
|
||||
For more control, use the javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] annotation, as shown in the following example:
|
||||
|
||||
include-code::MyApplication[]
|
||||
|
||||
|
||||
+6
-6
@@ -220,7 +220,7 @@ include-code::CityRepository[]
|
||||
|
||||
Repositories and documents are found through scanning.
|
||||
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
|
||||
You can customize the locations to look for repositories and documents by using javadoc:org.springframework.data.mongodb.repository.config.EnableMongoRepositories[format=annotation] and javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] respectively.
|
||||
You can customize the locations to look for repositories and documents by using javadoc:org.springframework.data.mongodb.repository.config.EnableMongoRepositories[format=annotation] and javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] respectively.
|
||||
|
||||
TIP: For complete details of Spring Data MongoDB, including its rich object mapping technologies, see its {url-spring-data-mongodb-docs}[reference documentation].
|
||||
|
||||
@@ -279,7 +279,7 @@ When Project Reactor is available on the classpath, the reactive style is also a
|
||||
|
||||
Repositories and entities are found through scanning.
|
||||
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
|
||||
You can customize the locations to look for repositories and entities by using javadoc:org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories[format=annotation] and javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] respectively.
|
||||
You can customize the locations to look for repositories and entities by using javadoc:org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories[format=annotation] and javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] respectively.
|
||||
|
||||
[NOTE]
|
||||
====
|
||||
@@ -402,7 +402,7 @@ You could take the JPA example from earlier and, assuming that `City` is now an
|
||||
|
||||
Repositories and documents are found through scanning.
|
||||
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
|
||||
You can customize the locations to look for repositories and documents by using javadoc:org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories[format=annotation] and javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] respectively.
|
||||
You can customize the locations to look for repositories and documents by using javadoc:org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories[format=annotation] and javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] respectively.
|
||||
|
||||
TIP: For complete details of Spring Data Elasticsearch, see the {url-spring-data-elasticsearch-docs}[reference documentation].
|
||||
|
||||
@@ -520,7 +520,7 @@ Currently, this is more limited than the JPA repositories discussed earlier and
|
||||
|
||||
Repositories and entities are found through scanning.
|
||||
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
|
||||
You can customize the locations to look for repositories and entities by using javadoc:org.springframework.data.cassandra.repository.config.EnableCassandraRepositories[format=annotation] and javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] respectively.
|
||||
You can customize the locations to look for repositories and entities by using javadoc:org.springframework.data.cassandra.repository.config.EnableCassandraRepositories[format=annotation] and javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] respectively.
|
||||
|
||||
TIP: For complete details of Spring Data Cassandra, see the {url-spring-data-cassandra-docs}[reference documentation].
|
||||
|
||||
@@ -610,7 +610,7 @@ Spring Data includes repository support for Couchbase.
|
||||
|
||||
Repositories and documents are found through scanning.
|
||||
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
|
||||
You can customize the locations to look for repositories and documents by using javadoc:org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories[format=annotation] and javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] respectively.
|
||||
You can customize the locations to look for repositories and documents by using javadoc:org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories[format=annotation] and javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] respectively.
|
||||
|
||||
For complete details of Spring Data Couchbase, see the {url-spring-data-couchbase-docs}[reference documentation].
|
||||
|
||||
@@ -683,7 +683,7 @@ Spring Data includes repository support for LDAP.
|
||||
|
||||
Repositories and documents are found through scanning.
|
||||
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
|
||||
You can customize the locations to look for repositories and documents by using javadoc:org.springframework.data.ldap.repository.config.EnableLdapRepositories[format=annotation] and javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] respectively.
|
||||
You can customize the locations to look for repositories and documents by using javadoc:org.springframework.data.ldap.repository.config.EnableLdapRepositories[format=annotation] and javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] respectively.
|
||||
|
||||
TIP: For complete details of Spring Data LDAP, see the {url-spring-data-ldap-docs}[reference documentation].
|
||||
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ A typical entity class resembles the following example:
|
||||
|
||||
include-code::City[]
|
||||
|
||||
TIP: You can customize entity scanning locations by using the javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] annotation.
|
||||
TIP: You can customize entity scanning locations by using the javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] annotation.
|
||||
See the xref:how-to:data-access.adoc#howto.data-access.separate-entity-definitions-from-spring-configuration[] section of the "`How-to Guides`".
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ TIP: If you wish to enforce a structure based on domains, take a look at https:/
|
||||
|
||||
When a class does not include a `package` declaration, it is considered to be in the "`default package`".
|
||||
The use of the "`default package`" is generally discouraged and should be avoided.
|
||||
It can cause particular problems for Spring Boot applications that use the javadoc:org.springframework.context.annotation.ComponentScan[format=annotation], javadoc:org.springframework.boot.context.properties.ConfigurationPropertiesScan[format=annotation], javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation], or javadoc:org.springframework.boot.autoconfigure.SpringBootApplication[format=annotation] annotations, since every class from every jar is read.
|
||||
It can cause particular problems for Spring Boot applications that use the javadoc:org.springframework.context.annotation.ComponentScan[format=annotation], javadoc:org.springframework.boot.context.properties.ConfigurationPropertiesScan[format=annotation], javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation], or javadoc:org.springframework.boot.autoconfigure.SpringBootApplication[format=annotation] annotations, since every class from every jar is read.
|
||||
|
||||
TIP: We recommend that you follow Java's recommended package naming conventions and use a reversed domain name (for example, `com.example.project`).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user