Skip to content

Commit 4c49cc7

Browse files
committed
avoid NPE in case of no "hibernateProperties" specified
1 parent e1a6bb2 commit 4c49cc7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

org.springframework.orm/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBean.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ public void afterPropertiesSet() {
152152
config.getProperties().put(Environment.CURRENT_SESSION_CONTEXT_CLASS, SpringSessionContext.class.getName());
153153
config.getProperties().put(Environment.DATASOURCE, this.dataSource);
154154
config.getProperties().put("hibernate.classLoader.application", this.resourcePatternResolver.getClassLoader());
155-
config.addProperties(this.hibernateProperties);
155+
if (this.hibernateProperties != null) {
156+
config.addProperties(this.hibernateProperties);
157+
}
156158
scanPackages(config);
157159
for (Class<?> annotatedClass : this.annotatedClasses) {
158160
ReflectionUtils.invokeMethod(addAnnotatedClassMethod, config, annotatedClass);

0 commit comments

Comments
 (0)