Skip to content

Commit cdd39ba

Browse files
committed
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
1 parent b71d647 commit cdd39ba

File tree

46 files changed

+121
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+121
-65
lines changed

buildSrc/src/main/java/org/springframework/boot/build/context/properties/DocumentConfigurationProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private void dataPrefixes(Config config) {
130130
config.accept("spring.ldap");
131131
config.accept("spring.mongodb");
132132
config.accept("spring.neo4j");
133-
config.accept("spring.dao");
133+
config.accept("spring.persistence");
134134
config.accept("spring.data");
135135
config.accept("spring.datasource");
136136
config.accept("spring.jooq");

core/spring-boot-autoconfigure/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ dependencies {
3030

3131
optional("com.github.ben-manes.caffeine:caffeine")
3232
optional("org.aspectj:aspectjweaver")
33-
optional("jakarta.persistence:jakarta.persistence-api")
3433
optional("jakarta.servlet:jakarta.servlet-api")
3534
optional("javax.money:money-api")
3635
optional("org.springframework:spring-web")

documentation/spring-boot-docs/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ dependencies {
105105
implementation(project(path: ":module:spring-boot-jsonb"))
106106
implementation(project(path: ":module:spring-boot-ldap"))
107107
implementation(project(path: ":module:spring-boot-micrometer-metrics"))
108+
implementation(project(path: ":module:spring-boot-persistence"))
108109
implementation(project(path: ":module:spring-boot-r2dbc"))
109110
implementation(project(path: ":module:spring-boot-reactor-netty"))
110111
implementation(project(path: ":module:spring-boot-restclient"))

documentation/spring-boot-docs/src/docs/antora/modules/how-to/pages/data-access.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ For more about Spring Data, see the {url-spring-data-site}[Spring Data project p
176176
== Separate @Entity Definitions from Spring Configuration
177177

178178
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].
179-
For more control, use the javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] annotation, as shown in the following example:
179+
For more control, use the javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] annotation, as shown in the following example:
180180

181181
include-code::MyApplication[]
182182

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/data/nosql.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ include-code::CityRepository[]
220220

221221
Repositories and documents are found through scanning.
222222
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
223-
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.
223+
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.
224224

225225
TIP: For complete details of Spring Data MongoDB, including its rich object mapping technologies, see its {url-spring-data-mongodb-docs}[reference documentation].
226226

@@ -279,7 +279,7 @@ When Project Reactor is available on the classpath, the reactive style is also a
279279

280280
Repositories and entities are found through scanning.
281281
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
282-
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.
282+
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.
283283

284284
[NOTE]
285285
====
@@ -402,7 +402,7 @@ You could take the JPA example from earlier and, assuming that `City` is now an
402402

403403
Repositories and documents are found through scanning.
404404
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
405-
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.
405+
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.
406406

407407
TIP: For complete details of Spring Data Elasticsearch, see the {url-spring-data-elasticsearch-docs}[reference documentation].
408408

@@ -520,7 +520,7 @@ Currently, this is more limited than the JPA repositories discussed earlier and
520520

521521
Repositories and entities are found through scanning.
522522
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
523-
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.
523+
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.
524524

525525
TIP: For complete details of Spring Data Cassandra, see the {url-spring-data-cassandra-docs}[reference documentation].
526526

@@ -610,7 +610,7 @@ Spring Data includes repository support for Couchbase.
610610

611611
Repositories and documents are found through scanning.
612612
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
613-
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.
613+
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.
614614

615615
For complete details of Spring Data Couchbase, see the {url-spring-data-couchbase-docs}[reference documentation].
616616

@@ -683,7 +683,7 @@ Spring Data includes repository support for LDAP.
683683

684684
Repositories and documents are found through scanning.
685685
By default, the xref:using/auto-configuration.adoc#using.auto-configuration.packages[auto-configuration packages] are scanned.
686-
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.
686+
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.
687687

688688
TIP: For complete details of Spring Data LDAP, see the {url-spring-data-ldap-docs}[reference documentation].
689689

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/data/sql.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ A typical entity class resembles the following example:
227227

228228
include-code::City[]
229229

230-
TIP: You can customize entity scanning locations by using the javadoc:org.springframework.boot.autoconfigure.domain.EntityScan[format=annotation] annotation.
230+
TIP: You can customize entity scanning locations by using the javadoc:org.springframework.boot.persistence.autoconfigure.EntityScan[format=annotation] annotation.
231231
See the xref:how-to:data-access.adoc#howto.data-access.separate-entity-definitions-from-spring-configuration[] section of the "`How-to Guides`".
232232

233233

documentation/spring-boot-docs/src/docs/antora/modules/reference/pages/using/structuring-your-code.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ TIP: If you wish to enforce a structure based on domains, take a look at https:/
1313

1414
When a class does not include a `package` declaration, it is considered to be in the "`default package`".
1515
The use of the "`default package`" is generally discouraged and should be avoided.
16-
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.
16+
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.
1717

1818
TIP: We recommend that you follow Java's recommended package naming conventions and use a reversed domain name (for example, `com.example.project`).
1919

documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/separateentitydefinitionsfromspringconfiguration/MyApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.boot.docs.howto.dataaccess.separateentitydefinitionsfromspringconfiguration;
1818

1919
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
20-
import org.springframework.boot.autoconfigure.domain.EntityScan;
20+
import org.springframework.boot.persistence.autoconfigure.EntityScan;
2121
import org.springframework.context.annotation.Configuration;
2222

2323
@Configuration(proxyBeanMethods = false)

documentation/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/howto/dataaccess/separateentitydefinitionsfromspringconfiguration/MyApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.boot.docs.howto.dataaccess.separateentitydefinitionsfromspringconfiguration
1818

1919
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
20-
import org.springframework.boot.autoconfigure.domain.EntityScan
20+
import org.springframework.boot.persistence.autoconfigure.EntityScan
2121
import org.springframework.context.annotation.Configuration
2222

2323
@Configuration(proxyBeanMethods = false)

module/spring-boot-data-cassandra/src/main/java/org/springframework/boot/data/cassandra/autoconfigure/CassandraDataAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2929
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3030
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
31-
import org.springframework.boot.autoconfigure.domain.EntityScanPackages;
3231
import org.springframework.boot.cassandra.autoconfigure.CassandraAutoConfiguration;
3332
import org.springframework.boot.context.properties.bind.Binder;
33+
import org.springframework.boot.persistence.autoconfigure.EntityScanPackages;
3434
import org.springframework.context.annotation.Bean;
3535
import org.springframework.context.annotation.Lazy;
3636
import org.springframework.core.env.Environment;

0 commit comments

Comments
 (0)