Relax EntityManagerFactoryBuilder Map generic

Relax the generic signature on EntityManagerFactoryBuilder.properties
so that any object type can be added.

Fixed gh-1376
This commit is contained in:
Phillip Webb 2014-08-15 11:49:25 -07:00
parent ebd0d265f8
commit b3ba86390f
3 changed files with 9 additions and 6 deletions

View File

@ -137,7 +137,7 @@ public class EntityManagerFactoryBuilder {
* @param properties the properties to use
* @return the builder for fluent usage
*/
public Builder properties(Map<String, String> properties) {
public Builder properties(Map<String, ?> properties) {
this.properties.putAll(properties);
return this;
}

View File

@ -16,6 +16,7 @@
package org.springframework.boot.autoconfigure.orm.jpa;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.persistence.EntityManager;
@ -67,8 +68,10 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration {
}
@Override
protected Map<String, String> getVendorProperties() {
return this.properties.getHibernateProperties(this.dataSource);
protected Map<String, Object> getVendorProperties() {
Map<String, Object> vendorProperties = new LinkedHashMap<String, Object>();
vendorProperties.putAll(this.properties.getHibernateProperties(this.dataSource));
return vendorProperties;
}
static class HibernateEntityManagerCondition extends SpringBootCondition {

View File

@ -102,14 +102,14 @@ public abstract class JpaBaseConfiguration implements BeanFactoryAware {
@Primary
@ConditionalOnMissingBean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
EntityManagerFactoryBuilder factory) {
return factory.dataSource(this.dataSource).packages(getPackagesToScan())
EntityManagerFactoryBuilder factoryBuilder) {
return factoryBuilder.dataSource(this.dataSource).packages(getPackagesToScan())
.properties(getVendorProperties()).build();
}
protected abstract AbstractJpaVendorAdapter createJpaVendorAdapter();
protected abstract Map<String, String> getVendorProperties();
protected abstract Map<String, Object> getVendorProperties();
protected EntityManagerFactoryBuilder.EntityManagerFactoryBeanCallback getVendorCallback() {
return null;