From 8d6f003e9a6493d4f3c2f1689debbedfbb1cdc6e Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 11 Jun 2014 16:54:11 +0100 Subject: [PATCH] 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 --- .../autoconfigure/orm/jpa/DataSourceInitializedPublisher.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java index 0444565f6ff..9f89a22acd4 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/DataSourceInitializedPublisher.java @@ -73,6 +73,9 @@ class DataSourceInitializedPublisher implements BeanPostProcessor { } private boolean isInitializingDatabase() { + if (this.properties == null) { + return true; // better safe than sorry + } Map hibernate = this.properties .getHibernateProperties(this.dataSource); if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {