Skip to content

Commit 8d6f003

Browse files
author
Dave Syer
committed
Defensive null check in case Hibernate autoconfig is off
If the Hibernate autoconfig is not used to create an EntityManager then I suppose it's possible that the JpaProperties might be null when everything else is ready for the event to be published. There's no test case because I think it's a corner case. Fxies gh-1075
1 parent 32a220d commit 8d6f003

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ && isInitializingDatabase()) {
7373
}
7474

7575
private boolean isInitializingDatabase() {
76+
if (this.properties == null) {
77+
return true; // better safe than sorry
78+
}
7679
Map<String, String> hibernate = this.properties
7780
.getHibernateProperties(this.dataSource);
7881
if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {

0 commit comments

Comments
 (0)