Skip to content

Commit 7733551

Browse files
committed
Stop relying on JPA entities from another module in tests
Closes gh-44804
1 parent d930b3e commit 7733551

File tree

5 files changed

+159
-3
lines changed

5 files changed

+159
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@
5656
import org.springframework.boot.autoconfigure.AutoConfigurations;
5757
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
5858
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration.SpringBootBatchConfiguration;
59+
import org.springframework.boot.autoconfigure.batch.domain.City;
5960
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
6061
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
6162
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
6263
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
6364
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
6465
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
65-
import org.springframework.boot.autoconfigure.orm.jpa.test.City;
6666
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
6767
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizationAutoConfiguration;
6868
import org.springframework.boot.jdbc.DataSourceBuilder;

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfigurationWithoutJpaTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
import org.springframework.boot.autoconfigure.AutoConfigurations;
2828
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
2929
import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration.SpringBootBatchConfiguration;
30+
import org.springframework.boot.autoconfigure.batch.domain.City;
3031
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
3132
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
32-
import org.springframework.boot.autoconfigure.orm.jpa.test.City;
3333
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
3434
import org.springframework.boot.sql.init.DatabaseInitializationMode;
3535
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright 2012-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.autoconfigure.batch.domain;
18+
19+
import java.io.Serializable;
20+
21+
import jakarta.persistence.Column;
22+
import jakarta.persistence.Entity;
23+
import jakarta.persistence.GeneratedValue;
24+
import jakarta.persistence.Id;
25+
26+
@Entity
27+
public class City implements Serializable {
28+
29+
private static final long serialVersionUID = 1L;
30+
31+
@Id
32+
@GeneratedValue
33+
private Long id;
34+
35+
@Column(nullable = false)
36+
private String name;
37+
38+
@Column(nullable = false)
39+
private String state;
40+
41+
@Column(nullable = false)
42+
private String country;
43+
44+
@Column(nullable = false)
45+
private String map;
46+
47+
protected City() {
48+
}
49+
50+
public City(String name, String state, String country, String map) {
51+
this.name = name;
52+
this.state = state;
53+
this.country = country;
54+
this.map = map;
55+
}
56+
57+
public String getName() {
58+
return this.name;
59+
}
60+
61+
public String getState() {
62+
return this.state;
63+
}
64+
65+
public String getCountry() {
66+
return this.country;
67+
}
68+
69+
public String getMap() {
70+
return this.map;
71+
}
72+
73+
@Override
74+
public String toString() {
75+
return getName() + "," + getState() + "," + getCountry();
76+
}
77+
78+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright 2012-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.boot.autoconfigure.security.jpa;
18+
19+
import java.io.Serializable;
20+
21+
import jakarta.persistence.Column;
22+
import jakarta.persistence.Entity;
23+
import jakarta.persistence.GeneratedValue;
24+
import jakarta.persistence.Id;
25+
26+
@Entity
27+
public class City implements Serializable {
28+
29+
private static final long serialVersionUID = 1L;
30+
31+
@Id
32+
@GeneratedValue
33+
private Long id;
34+
35+
@Column(nullable = false)
36+
private String name;
37+
38+
@Column(nullable = false)
39+
private String state;
40+
41+
@Column(nullable = false)
42+
private String country;
43+
44+
@Column(nullable = false)
45+
private String map;
46+
47+
protected City() {
48+
}
49+
50+
public City(String name, String state, String country, String map) {
51+
this.name = name;
52+
this.state = state;
53+
this.country = country;
54+
this.map = map;
55+
}
56+
57+
public String getName() {
58+
return this.name;
59+
}
60+
61+
public String getState() {
62+
return this.state;
63+
}
64+
65+
public String getCountry() {
66+
return this.country;
67+
}
68+
69+
public String getMap() {
70+
return this.map;
71+
}
72+
73+
@Override
74+
public String toString() {
75+
return getName() + "," + getState() + "," + getCountry();
76+
}
77+
78+
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/servlet/SecurityAutoConfigurationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
3333
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
3434
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
35-
import org.springframework.boot.autoconfigure.orm.jpa.test.City;
35+
import org.springframework.boot.autoconfigure.security.jpa.City;
3636
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
3737
import org.springframework.boot.context.properties.ConfigurationProperties;
3838
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;

0 commit comments

Comments
 (0)