|
|
@ -28,20 +28,29 @@ import javax.sql.DataSource;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
|
|
|
import org.hibernate.boot.model.naming.CamelCaseToUnderscoresNamingStrategy;
|
|
|
|
import org.hibernate.boot.model.naming.ImplicitNamingStrategy;
|
|
|
|
import org.hibernate.boot.model.naming.ImplicitNamingStrategy;
|
|
|
|
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
|
|
|
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
|
|
|
import org.hibernate.cfg.AvailableSettings;
|
|
|
|
import org.hibernate.cfg.AvailableSettings;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.aot.hint.MemberCategory;
|
|
|
|
|
|
|
|
import org.springframework.aot.hint.RuntimeHints;
|
|
|
|
|
|
|
|
import org.springframework.aot.hint.RuntimeHintsRegistrar;
|
|
|
|
|
|
|
|
import org.springframework.aot.hint.TypeHint;
|
|
|
|
|
|
|
|
import org.springframework.aot.hint.TypeReference;
|
|
|
|
import org.springframework.beans.factory.ObjectProvider;
|
|
|
|
import org.springframework.beans.factory.ObjectProvider;
|
|
|
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
|
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
|
|
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.HibernateRuntimeHints;
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
|
|
|
import org.springframework.boot.jdbc.SchemaManagementProvider;
|
|
|
|
import org.springframework.boot.jdbc.SchemaManagementProvider;
|
|
|
|
import org.springframework.boot.jdbc.metadata.CompositeDataSourcePoolMetadataProvider;
|
|
|
|
import org.springframework.boot.jdbc.metadata.CompositeDataSourcePoolMetadataProvider;
|
|
|
|
import org.springframework.boot.jdbc.metadata.DataSourcePoolMetadata;
|
|
|
|
import org.springframework.boot.jdbc.metadata.DataSourcePoolMetadata;
|
|
|
|
import org.springframework.boot.jdbc.metadata.DataSourcePoolMetadataProvider;
|
|
|
|
import org.springframework.boot.jdbc.metadata.DataSourcePoolMetadataProvider;
|
|
|
|
|
|
|
|
import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy;
|
|
|
|
import org.springframework.boot.orm.jpa.hibernate.SpringJtaPlatform;
|
|
|
|
import org.springframework.boot.orm.jpa.hibernate.SpringJtaPlatform;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.ImportRuntimeHints;
|
|
|
|
import org.springframework.jndi.JndiLocatorDelegate;
|
|
|
|
import org.springframework.jndi.JndiLocatorDelegate;
|
|
|
|
import org.springframework.orm.hibernate5.SpringBeanContainer;
|
|
|
|
import org.springframework.orm.hibernate5.SpringBeanContainer;
|
|
|
|
import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter;
|
|
|
|
import org.springframework.orm.jpa.vendor.AbstractJpaVendorAdapter;
|
|
|
@ -57,10 +66,12 @@ import org.springframework.util.ClassUtils;
|
|
|
|
* @author Manuel Doninger
|
|
|
|
* @author Manuel Doninger
|
|
|
|
* @author Andy Wilkinson
|
|
|
|
* @author Andy Wilkinson
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
|
|
|
|
* @author Moritz Halbritter
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@EnableConfigurationProperties(HibernateProperties.class)
|
|
|
|
@EnableConfigurationProperties(HibernateProperties.class)
|
|
|
|
@ConditionalOnSingleCandidate(DataSource.class)
|
|
|
|
@ConditionalOnSingleCandidate(DataSource.class)
|
|
|
|
|
|
|
|
@ImportRuntimeHints(HibernateRuntimeHints.class)
|
|
|
|
class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
|
|
|
class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
private static final Log logger = LogFactory.getLog(HibernateJpaConfiguration.class);
|
|
|
|
private static final Log logger = LogFactory.getLog(HibernateJpaConfiguration.class);
|
|
|
@ -237,4 +248,23 @@ class HibernateJpaConfiguration extends JpaBaseConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static class HibernateRuntimeHints implements RuntimeHintsRegistrar {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
|
|
|
|
|
|
|
|
for (String clazz : NO_JTA_PLATFORM_CLASSES) {
|
|
|
|
|
|
|
|
hints.reflection()
|
|
|
|
|
|
|
|
.registerType(TypeReference.of(clazz),
|
|
|
|
|
|
|
|
TypeHint.builtWith(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
hints.reflection()
|
|
|
|
|
|
|
|
.registerType(SpringImplicitNamingStrategy.class,
|
|
|
|
|
|
|
|
TypeHint.builtWith(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS));
|
|
|
|
|
|
|
|
hints.reflection()
|
|
|
|
|
|
|
|
.registerType(CamelCaseToUnderscoresNamingStrategy.class,
|
|
|
|
|
|
|
|
TypeHint.builtWith(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|