|
|
@ -27,6 +27,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy;
|
|
|
|
import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy;
|
|
|
|
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
|
|
|
|
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
import org.springframework.util.Assert;
|
|
|
|
|
|
|
|
import org.springframework.util.ClassUtils;
|
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
@ -34,13 +35,14 @@ import org.springframework.util.StringUtils;
|
|
|
|
* Configuration properties for Hibernate.
|
|
|
|
* Configuration properties for Hibernate.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @author Artsiom Yudovin
|
|
|
|
|
|
|
|
* @since 2.1.0
|
|
|
|
* @since 2.1.0
|
|
|
|
* @see JpaProperties
|
|
|
|
* @see JpaProperties
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ConfigurationProperties("spring.jpa.hibernate")
|
|
|
|
@ConfigurationProperties("spring.jpa.hibernate")
|
|
|
|
public class HibernateProperties {
|
|
|
|
public class HibernateProperties {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String DISABLED_SCANNER_CLASS = "org.hibernate.boot.archive.scan.internal.DisabledScanner";
|
|
|
|
|
|
|
|
|
|
|
|
private final Naming naming = new Naming();
|
|
|
|
private final Naming naming = new Naming();
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -96,7 +98,7 @@ public class HibernateProperties {
|
|
|
|
HibernateSettings settings) {
|
|
|
|
HibernateSettings settings) {
|
|
|
|
Map<String, Object> result = new HashMap<>(existing);
|
|
|
|
Map<String, Object> result = new HashMap<>(existing);
|
|
|
|
applyNewIdGeneratorMappings(result);
|
|
|
|
applyNewIdGeneratorMappings(result);
|
|
|
|
applyArchiveScanner(result);
|
|
|
|
applyScanner(result);
|
|
|
|
getNaming().applyNamingStrategies(result);
|
|
|
|
getNaming().applyNamingStrategies(result);
|
|
|
|
String ddlAuto = determineDdlAuto(existing, settings::getDdlAuto);
|
|
|
|
String ddlAuto = determineDdlAuto(existing, settings::getDdlAuto);
|
|
|
|
if (StringUtils.hasText(ddlAuto) && !"none".equals(ddlAuto)) {
|
|
|
|
if (StringUtils.hasText(ddlAuto) && !"none".equals(ddlAuto)) {
|
|
|
@ -123,10 +125,10 @@ public class HibernateProperties {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void applyArchiveScanner(Map<String, Object> result) {
|
|
|
|
private void applyScanner(Map<String, Object> result) {
|
|
|
|
if (!result.containsKey(AvailableSettings.SCANNER)) {
|
|
|
|
if (!result.containsKey(AvailableSettings.SCANNER)
|
|
|
|
result.put(AvailableSettings.SCANNER,
|
|
|
|
&& ClassUtils.isPresent(DISABLED_SCANNER_CLASS, null)) {
|
|
|
|
"org.hibernate.boot.archive.scan.internal.DisabledScanner");
|
|
|
|
result.put(AvailableSettings.SCANNER, DISABLED_SCANNER_CLASS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|