Skip to content

Commit fb0f27c

Browse files
committed
Move EMFDependsOnPostProcessor into autoconfigure.orm.jpa
Closes gh-24452
1 parent 69c6b6b commit fb0f27c

File tree

9 files changed

+75
-15
lines changed

9 files changed

+75
-15
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.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.ConditionalOnClass;
2929
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3030
import org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration;
31-
import org.springframework.boot.autoconfigure.data.jpa.EntityManagerFactoryDependsOnPostProcessor;
3231
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
3332
import org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration;
33+
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor;
3434
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
3535
import org.springframework.boot.context.properties.EnableConfigurationProperties;
3636
import org.springframework.cache.CacheManager;

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/EntityManagerFactoryDependsOnPostProcessor.java

Lines changed: 8 additions & 6 deletions
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-2020 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.
@@ -20,8 +20,6 @@
2020

2121
import org.springframework.beans.factory.config.BeanDefinition;
2222
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
23-
import org.springframework.boot.autoconfigure.AbstractDependsOnBeanFactoryPostProcessor;
24-
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
2523

2624
/**
2725
* {@link BeanFactoryPostProcessor} that can be used to dynamically declare that all
@@ -34,16 +32,20 @@
3432
* @author Andrii Hrytsiuk
3533
* @since 1.1.0
3634
* @see BeanDefinition#setDependsOn(String[])
35+
* @deprecated since 2.5.0 in favor of
36+
* {@link org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor}
3737
*/
38-
public class EntityManagerFactoryDependsOnPostProcessor extends AbstractDependsOnBeanFactoryPostProcessor {
38+
@Deprecated
39+
public class EntityManagerFactoryDependsOnPostProcessor
40+
extends org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor {
3941

4042
/**
4143
* Creates a new {@code EntityManagerFactoryDependsOnPostProcessor} that will set up
4244
* dependencies upon beans with the given names.
4345
* @param dependsOn names of the beans to depend upon
4446
*/
4547
public EntityManagerFactoryDependsOnPostProcessor(String... dependsOn) {
46-
super(EntityManagerFactory.class, AbstractEntityManagerFactoryBean.class, dependsOn);
48+
super(dependsOn);
4749
}
4850

4951
/**
@@ -53,7 +55,7 @@ public EntityManagerFactoryDependsOnPostProcessor(String... dependsOn) {
5355
* @since 2.1.8
5456
*/
5557
public EntityManagerFactoryDependsOnPostProcessor(Class<?>... dependsOn) {
56-
super(EntityManagerFactory.class, AbstractEntityManagerFactoryBean.class, dependsOn);
58+
super(dependsOn);
5759
}
5860

5961
}

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
4444
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
4545
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
46-
import org.springframework.boot.autoconfigure.data.jpa.EntityManagerFactoryDependsOnPostProcessor;
4746
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration.FlywayDataSourceCondition;
4847
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration.FlywayEntityManagerFactoryDependsOnPostProcessor;
4948
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration.FlywayJdbcOperationsDependsOnPostProcessor;
@@ -53,6 +52,7 @@
5352
import org.springframework.boot.autoconfigure.jdbc.JdbcOperationsDependsOnPostProcessor;
5453
import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration;
5554
import org.springframework.boot.autoconfigure.jdbc.NamedParameterJdbcOperationsDependsOnPostProcessor;
55+
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor;
5656
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
5757
import org.springframework.boot.context.properties.ConfigurationPropertiesBinding;
5858
import org.springframework.boot.context.properties.EnableConfigurationProperties;

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastJpaDependencyAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
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-2020 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.
@@ -24,8 +24,8 @@
2424
import org.springframework.boot.autoconfigure.condition.AllNestedConditions;
2525
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2626
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
27-
import org.springframework.boot.autoconfigure.data.jpa.EntityManagerFactoryDependsOnPostProcessor;
2827
import org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration.HazelcastInstanceEntityManagerFactoryDependsOnPostProcessor;
28+
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor;
2929
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
3030
import org.springframework.context.annotation.Conditional;
3131
import org.springframework.context.annotation.Configuration;

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3333
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3434
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
35-
import org.springframework.boot.autoconfigure.data.jpa.EntityManagerFactoryDependsOnPostProcessor;
3635
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
3736
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
3837
import org.springframework.boot.autoconfigure.jdbc.JdbcOperationsDependsOnPostProcessor;
@@ -41,6 +40,7 @@
4140
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration.LiquibaseEntityManagerFactoryDependsOnPostProcessor;
4241
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration.LiquibaseJdbcOperationsDependsOnPostProcessor;
4342
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration.LiquibaseNamedParameterJdbcOperationsDependsOnPostProcessor;
43+
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor;
4444
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
4545
import org.springframework.boot.context.properties.EnableConfigurationProperties;
4646
import org.springframework.boot.jdbc.DataSourceBuilder;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2012-2020 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.orm.jpa;
18+
19+
import javax.persistence.EntityManagerFactory;
20+
21+
import org.springframework.beans.factory.config.BeanDefinition;
22+
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
23+
import org.springframework.boot.autoconfigure.AbstractDependsOnBeanFactoryPostProcessor;
24+
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
25+
26+
/**
27+
* {@link BeanFactoryPostProcessor} that can be used to dynamically declare that all
28+
* {@link EntityManagerFactory} beans should "depend on" one or more specific beans.
29+
*
30+
* @author Marcel Overdijk
31+
* @author Dave Syer
32+
* @author Phillip Webb
33+
* @author Andy Wilkinson
34+
* @author Andrii Hrytsiuk
35+
* @since 2.5.0
36+
* @see BeanDefinition#setDependsOn(String[])
37+
*/
38+
public class EntityManagerFactoryDependsOnPostProcessor extends AbstractDependsOnBeanFactoryPostProcessor {
39+
40+
/**
41+
* Creates a new {@code EntityManagerFactoryDependsOnPostProcessor} that will set up
42+
* dependencies upon beans with the given names.
43+
* @param dependsOn names of the beans to depend upon
44+
*/
45+
public EntityManagerFactoryDependsOnPostProcessor(String... dependsOn) {
46+
super(EntityManagerFactory.class, AbstractEntityManagerFactoryBean.class, dependsOn);
47+
}
48+
49+
/**
50+
* Creates a new {@code EntityManagerFactoryDependsOnPostProcessor} that will set up
51+
* dependencies upon beans with the given types.
52+
* @param dependsOn types of the beans to depend upon
53+
*/
54+
public EntityManagerFactoryDependsOnPostProcessor(Class<?>... dependsOn) {
55+
super(EntityManagerFactory.class, AbstractEntityManagerFactoryBean.class, dependsOn);
56+
}
57+
58+
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/hazelcast/HazelcastJpaDependencyAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
2828
import org.springframework.boot.autoconfigure.AutoConfigurations;
29-
import org.springframework.boot.autoconfigure.data.jpa.EntityManagerFactoryDependsOnPostProcessor;
3029
import org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration.HazelcastInstanceEntityManagerFactoryDependsOnPostProcessor;
3130
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
31+
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor;
3232
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
3333
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
3434
import org.springframework.boot.test.context.runner.ApplicationContextRunner;

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/DevToolsDataSourceAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
3939
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
4040
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
41-
import org.springframework.boot.autoconfigure.data.jpa.EntityManagerFactoryDependsOnPostProcessor;
4241
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
4342
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
43+
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor;
4444
import org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration.DatabaseShutdownExecutorEntityManagerFactoryDependsOnPostProcessor;
4545
import org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration.DevToolsDataSourceCondition;
4646
import org.springframework.context.annotation.Bean;

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/elasticsearch/HibernateSearchElasticsearchExample.java

Lines changed: 2 additions & 2 deletions
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-2020 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.
@@ -18,7 +18,7 @@
1818

1919
import javax.persistence.EntityManagerFactory;
2020

21-
import org.springframework.boot.autoconfigure.data.jpa.EntityManagerFactoryDependsOnPostProcessor;
21+
import org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryDependsOnPostProcessor;
2222
import org.springframework.stereotype.Component;
2323

2424
/**

0 commit comments

Comments
 (0)