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
This commit is contained in:
Dave Syer 2014-06-11 16:54:11 +01:00
parent 32a220da8f
commit 8d6f003e9a
1 changed files with 3 additions and 0 deletions

View File

@ -73,6 +73,9 @@ class DataSourceInitializedPublisher implements BeanPostProcessor {
}
private boolean isInitializingDatabase() {
if (this.properties == null) {
return true; // better safe than sorry
}
Map<String, String> hibernate = this.properties
.getHibernateProperties(this.dataSource);
if (hibernate.containsKey("hibernate.hbm2ddl.auto")) {