Skip to content

Commit 51a267e

Browse files
committed
Create spring-boot-data-jpa module
1 parent 24184a9 commit 51a267e

File tree

38 files changed

+202
-96
lines changed

38 files changed

+202
-96
lines changed

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ include "spring-boot-project:spring-boot-amqp"
4747
include "spring-boot-project:spring-boot-artemis"
4848
include "spring-boot-project:spring-boot-autoconfigure"
4949
include "spring-boot-project:spring-boot-autoconfigure-all"
50+
include "spring-boot-project:spring-boot-data-jpa"
5051
include "spring-boot-project:spring-boot-dependencies"
5152
include "spring-boot-project:spring-boot-devtools"
5253
include "spring-boot-project:spring-boot-docker-compose"

spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ dependencies {
2020
optional(project(":spring-boot-project:spring-boot-activemq"))
2121
optional(project(":spring-boot-project:spring-boot-amqp"))
2222
optional(project(":spring-boot-project:spring-boot-artemis"))
23+
optional(project(":spring-boot-project:spring-boot-data-jpa"))
2324
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
2425
optional(project(":spring-boot-project:spring-boot-flyway"))
2526
optional(project(":spring-boot-project:spring-boot-jackson"))
2627
optional(project(":spring-boot-project:spring-boot-jdbc"))
2728
optional(project(":spring-boot-project:spring-boot-jetty"))
28-
optional(project(":spring-boot-project:spring-boot-jpa"))
2929
optional(project(":spring-boot-project:spring-boot-jsonb"))
3030
optional(project(":spring-boot-project:spring-boot-kafka"))
3131
optional(project(":spring-boot-project:spring-boot-liquibase"))

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/data/RepositoryMetricsAutoConfigurationIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import org.springframework.boot.autoconfigure.AutoConfigurationPackage;
2727
import org.springframework.boot.autoconfigure.AutoConfigurations;
2828
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
29-
import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
29+
import org.springframework.boot.data.jpa.autoconfigure.JpaRepositoriesAutoConfiguration;
3030
import org.springframework.boot.jdbc.autoconfigure.EmbeddedDataSourceConfiguration;
3131
import org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration;
3232
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

spring-boot-project/spring-boot-autoconfigure-all/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ dependencies {
4343

4444
optional(project(":spring-boot-project:spring-boot-activemq"))
4545
optional(project(":spring-boot-project:spring-boot-artemis"))
46+
optional(project(":spring-boot-project:spring-boot-data-jpa"))
4647
optional(project(":spring-boot-project:spring-boot-elasticsearch"))
4748
optional(project(":spring-boot-project:spring-boot-flyway"))
4849
optional(project(":spring-boot-project:spring-boot-jackson"))
4950
optional(project(":spring-boot-project:spring-boot-jdbc"))
50-
optional(project(":spring-boot-project:spring-boot-jpa"))
5151
optional(project(":spring-boot-project:spring-boot-jsonb"))
5252
optional(project(":spring-boot-project:spring-boot-liquibase"))
5353
optional(project(":spring-boot-project:spring-boot-r2dbc"))
@@ -179,7 +179,6 @@ dependencies {
179179
exclude group: "javax.xml.bind", module: "jaxb-api"
180180
exclude group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec"
181181
}
182-
optional("org.springframework.data:spring-data-jpa")
183182
optional("org.springframework.data:spring-data-rest-webmvc")
184183
optional("org.springframework.data:spring-data-cassandra") {
185184
exclude group: "org.slf4j", module: "jcl-over-slf4j"

spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json

-12
Original file line numberDiff line numberDiff line change
@@ -546,18 +546,6 @@
546546
"description": "Whether to enable JDBC repositories.",
547547
"defaultValue": true
548548
},
549-
{
550-
"name": "spring.data.jpa.repositories.bootstrap-mode",
551-
"type": "org.springframework.data.repository.config.BootstrapMode",
552-
"description": "Bootstrap mode for JPA repositories.",
553-
"defaultValue": "default"
554-
},
555-
{
556-
"name": "spring.data.jpa.repositories.enabled",
557-
"type": "java.lang.Boolean",
558-
"description": "Whether to enable JPA repositories.",
559-
"defaultValue": true
560-
},
561549
{
562550
"name": "spring.data.ldap.repositories.enabled",
563551
"type": "java.lang.Boolean",

spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoC
1616
org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration
1717
org.springframework.boot.autoconfigure.data.elasticsearch.ReactiveElasticsearchRepositoriesAutoConfiguration
1818
org.springframework.boot.autoconfigure.data.jdbc.JdbcRepositoriesAutoConfiguration
19-
org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration
2019
org.springframework.boot.autoconfigure.data.ldap.LdapRepositoriesAutoConfiguration
2120
org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration
2221
org.springframework.boot.autoconfigure.data.mongo.MongoReactiveDataAutoConfiguration
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.data.jpa.city;
17+
package org.springframework.boot.autoconfigure.data.alt.jpa;
1818

1919
import java.io.Serializable;
2020

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/alt/jpa/CityJpaRepository.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.boot.autoconfigure.data.alt.jpa;
1818

19-
import org.springframework.boot.autoconfigure.data.jpa.city.City;
2019
import org.springframework.data.repository.Repository;
2120

2221
public interface CityJpaRepository extends Repository<City, Long> {

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/mongo/MixedMongoRepositoriesAutoConfigurationTests.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
import org.junit.jupiter.api.Test;
2424

2525
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
26-
import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
27-
import org.springframework.boot.autoconfigure.data.jpa.city.City;
28-
import org.springframework.boot.autoconfigure.data.jpa.city.CityRepository;
26+
import org.springframework.boot.autoconfigure.data.alt.jpa.City;
27+
import org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository;
2928
import org.springframework.boot.autoconfigure.data.mongo.country.Country;
3029
import org.springframework.boot.autoconfigure.data.mongo.country.CountryRepository;
3130
import org.springframework.boot.autoconfigure.domain.EntityScan;
3231
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
32+
import org.springframework.boot.data.jpa.autoconfigure.JpaRepositoriesAutoConfiguration;
3333
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
3434
import org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration;
3535
import org.springframework.boot.test.util.TestPropertyValues;
@@ -73,23 +73,23 @@ void testMixedRepositoryConfiguration() {
7373
this.context.register(MixedConfiguration.class, BaseConfiguration.class);
7474
this.context.refresh();
7575
assertThat(this.context.getBean(CountryRepository.class)).isNotNull();
76-
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
76+
assertThat(this.context.getBean(CityJpaRepository.class)).isNotNull();
7777
}
7878

7979
@Test
8080
void testJpaRepositoryConfigurationWithMongoTemplate() {
8181
this.context = new AnnotationConfigApplicationContext();
8282
this.context.register(JpaConfiguration.class, BaseConfiguration.class);
8383
this.context.refresh();
84-
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
84+
assertThat(this.context.getBean(CityJpaRepository.class)).isNotNull();
8585
}
8686

8787
@Test
8888
void testJpaRepositoryConfigurationWithMongoOverlap() {
8989
this.context = new AnnotationConfigApplicationContext();
9090
this.context.register(OverlapConfiguration.class, BaseConfiguration.class);
9191
this.context.refresh();
92-
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
92+
assertThat(this.context.getBean(CityJpaRepository.class)).isNotNull();
9393
}
9494

9595
@Test
@@ -98,7 +98,7 @@ void testJpaRepositoryConfigurationWithMongoOverlapDisabled() {
9898
TestPropertyValues.of("spring.data.mongodb.repositories.type:none").applyTo(this.context);
9999
this.context.register(OverlapConfiguration.class, BaseConfiguration.class);
100100
this.context.refresh();
101-
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
101+
assertThat(this.context.getBean(CityJpaRepository.class)).isNotNull();
102102
}
103103

104104
@Configuration(proxyBeanMethods = false)
@@ -113,24 +113,24 @@ static class TestConfiguration {
113113
@TestAutoConfigurationPackage(MongoAutoConfiguration.class)
114114
@EnableMongoRepositories(basePackageClasses = Country.class)
115115
@EntityScan(basePackageClasses = City.class)
116-
@EnableJpaRepositories(basePackageClasses = CityRepository.class)
116+
@EnableJpaRepositories(basePackageClasses = CityJpaRepository.class)
117117
static class MixedConfiguration {
118118

119119
}
120120

121121
@Configuration(proxyBeanMethods = false)
122122
@TestAutoConfigurationPackage(MongoAutoConfiguration.class)
123123
@EntityScan(basePackageClasses = City.class)
124-
@EnableJpaRepositories(basePackageClasses = CityRepository.class)
124+
@EnableJpaRepositories(basePackageClasses = CityJpaRepository.class)
125125
static class JpaConfiguration {
126126

127127
}
128128

129129
// In this one the Jpa repositories and the auto-configuration packages overlap, so
130130
// Mongo will try and configure the same repositories
131131
@Configuration(proxyBeanMethods = false)
132-
@TestAutoConfigurationPackage(CityRepository.class)
133-
@EnableJpaRepositories(basePackageClasses = CityRepository.class)
132+
@TestAutoConfigurationPackage(CityJpaRepository.class)
133+
@EnableJpaRepositories(basePackageClasses = CityJpaRepository.class)
134134
static class OverlapConfiguration {
135135

136136
}

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/MixedNeo4jRepositoriesAutoConfigurationTests.java

+11-11
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
import org.neo4j.driver.internal.logging.Slf4jLogging;
2626

2727
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
28-
import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
29-
import org.springframework.boot.autoconfigure.data.jpa.city.City;
30-
import org.springframework.boot.autoconfigure.data.jpa.city.CityRepository;
28+
import org.springframework.boot.autoconfigure.data.alt.jpa.City;
29+
import org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository;
3130
import org.springframework.boot.autoconfigure.data.neo4j.country.Country;
3231
import org.springframework.boot.autoconfigure.data.neo4j.country.CountryRepository;
3332
import org.springframework.boot.autoconfigure.data.neo4j.empty.EmptyMarker;
3433
import org.springframework.boot.autoconfigure.domain.EntityScan;
34+
import org.springframework.boot.data.jpa.autoconfigure.JpaRepositoriesAutoConfiguration;
3535
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
3636
import org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration;
3737
import org.springframework.boot.test.util.TestPropertyValues;
@@ -75,26 +75,26 @@ void testDefaultRepositoryConfiguration() {
7575
void testMixedRepositoryConfiguration() {
7676
load(MixedConfiguration.class);
7777
assertThat(this.context.getBean(CountryRepository.class)).isNotNull();
78-
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
78+
assertThat(this.context.getBean(CityJpaRepository.class)).isNotNull();
7979
}
8080

8181
@Test
8282
void testJpaRepositoryConfigurationWithNeo4jTemplate() {
8383
load(JpaConfiguration.class);
84-
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
84+
assertThat(this.context.getBean(CityJpaRepository.class)).isNotNull();
8585
}
8686

8787
@Test
8888
@Disabled
8989
void testJpaRepositoryConfigurationWithNeo4jOverlap() {
9090
load(OverlapConfiguration.class);
91-
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
91+
assertThat(this.context.getBean(CityJpaRepository.class)).isNotNull();
9292
}
9393

9494
@Test
9595
void testJpaRepositoryConfigurationWithNeo4jOverlapDisabled() {
9696
load(OverlapConfiguration.class, "spring.data.neo4j.repositories.enabled:false");
97-
assertThat(this.context.getBean(CityRepository.class)).isNotNull();
97+
assertThat(this.context.getBean(CityJpaRepository.class)).isNotNull();
9898
}
9999

100100
private void load(Class<?> config, String... environment) {
@@ -128,7 +128,7 @@ public Driver driver() {
128128
@TestAutoConfigurationPackage(EmptyMarker.class)
129129
@EnableNeo4jRepositories(basePackageClasses = Country.class)
130130
@EntityScan(basePackageClasses = City.class)
131-
@EnableJpaRepositories(basePackageClasses = CityRepository.class)
131+
@EnableJpaRepositories(basePackageClasses = CityJpaRepository.class)
132132
static class MixedConfiguration extends AbstractNeo4jConfig {
133133

134134
@Override
@@ -143,16 +143,16 @@ public Driver driver() {
143143
@Configuration(proxyBeanMethods = false)
144144
@TestAutoConfigurationPackage(EmptyMarker.class)
145145
@EntityScan(basePackageClasses = City.class)
146-
@EnableJpaRepositories(basePackageClasses = CityRepository.class)
146+
@EnableJpaRepositories(basePackageClasses = CityJpaRepository.class)
147147
static class JpaConfiguration {
148148

149149
}
150150

151151
// In this one the Jpa repositories and the auto-configuration packages overlap, so
152152
// Neo4j will try and configure the same repositories
153153
@Configuration(proxyBeanMethods = false)
154-
@TestAutoConfigurationPackage(CityRepository.class)
155-
@EnableJpaRepositories(basePackageClasses = CityRepository.class)
154+
@TestAutoConfigurationPackage(CityJpaRepository.class)
155+
@EnableJpaRepositories(basePackageClasses = CityJpaRepository.class)
156156
static class OverlapConfiguration {
157157

158158
}

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfigurationTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
2525
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
2626
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
27-
import org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration;
28-
import org.springframework.boot.autoconfigure.data.jpa.city.City;
27+
import org.springframework.boot.autoconfigure.data.alt.jpa.City;
28+
import org.springframework.boot.data.jpa.autoconfigure.JpaRepositoriesAutoConfiguration;
2929
import org.springframework.boot.jackson.autoconfigure.JacksonAutoConfiguration;
3030
import org.springframework.boot.jdbc.autoconfigure.EmbeddedDataSourceConfiguration;
3131
import org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration;
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.data.jpa;
17+
package org.springframework.boot.autoconfigure.data.web;
1818

1919
import org.junit.jupiter.api.Test;
2020

2121
import org.springframework.boot.autoconfigure.AutoConfigurations;
2222
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
23-
import org.springframework.boot.autoconfigure.data.jpa.city.City;
24-
import org.springframework.boot.autoconfigure.data.jpa.city.CityRepository;
25-
import org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration;
23+
import org.springframework.boot.autoconfigure.data.alt.jpa.City;
24+
import org.springframework.boot.autoconfigure.data.alt.jpa.CityJpaRepository;
25+
import org.springframework.boot.data.jpa.autoconfigure.JpaRepositoriesAutoConfiguration;
2626
import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration;
2727
import org.springframework.boot.jpa.autoconfigure.hibernate.HibernateJpaAutoConfiguration;
2828
import org.springframework.boot.test.context.runner.WebApplicationContextRunner;
@@ -42,7 +42,7 @@
4242
* @author Dave Syer
4343
* @author Stephane Nicoll
4444
*/
45-
class JpaWebAutoConfigurationTests {
45+
class SpringDataWebAutoConfigurationJpaTests {
4646

4747
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
4848
.withConfiguration(AutoConfigurations.of(DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class,
@@ -52,7 +52,7 @@ class JpaWebAutoConfigurationTests {
5252
@Test
5353
void springDataWebIsConfiguredWithJpaRepositories() {
5454
this.contextRunner.withUserConfiguration(TestConfiguration.class).run((context) -> {
55-
assertThat(context).hasSingleBean(CityRepository.class);
55+
assertThat(context).hasSingleBean(CityJpaRepository.class);
5656
assertThat(context).hasSingleBean(PageableHandlerMethodArgumentResolver.class);
5757
assertThat(context).hasSingleBean(SortHandlerMethodArgumentResolver.class);
5858
assertThat(context.getBean(FormattingConversionService.class).canConvert(String.class, Distance.class))

spring-boot-project/spring-boot-autoconfigure/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ dependencies {
1515
optional("jakarta.persistence:jakarta.persistence-api")
1616
optional("jakarta.servlet:jakarta.servlet-api")
1717
optional("org.springframework:spring-web")
18+
optional("org.springframework.data:spring-data-commons")
1819

1920
testFixturesCompileOnly(project(":spring-boot-project:spring-boot-test"))
2021
testFixturesCompileOnly(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)