HHH-14020 add getServiceRegistry() to TypeBootstrapContext

This commit is contained in:
Gavin King 2024-11-22 21:52:44 +01:00 committed by Steve Ebersole
parent ec5bbe4546
commit f5062fca66
4 changed files with 14 additions and 4 deletions

View File

@ -101,7 +101,7 @@ public class BootstrapContextImpl implements BootstrapContext {
this.representationStrategySelector = ManagedTypeRepresentationResolverStandard.INSTANCE;
this.typeConfiguration = new TypeConfiguration();
this.beanInstanceProducer = new TypeBeanInstanceProducer( configService );
this.beanInstanceProducer = new TypeBeanInstanceProducer( configService, serviceRegistry );
this.sqmFunctionRegistry = new SqmFunctionRegistry();
}

View File

@ -10,6 +10,7 @@ import org.hibernate.engine.config.spi.ConfigurationService;
import org.hibernate.internal.util.ReflectHelper;
import org.hibernate.resource.beans.spi.BeanInstanceProducer;
import org.hibernate.type.spi.TypeBootstrapContext;
import org.hibernate.service.ServiceRegistry;
import java.lang.reflect.Constructor;
import java.util.Map;
@ -22,9 +23,11 @@ import java.util.Map;
@Internal
public class TypeBeanInstanceProducer implements BeanInstanceProducer, TypeBootstrapContext {
private final ConfigurationService configurationService;
private final ServiceRegistry serviceRegistry;
public TypeBeanInstanceProducer(ConfigurationService configurationService) {
public TypeBeanInstanceProducer(ConfigurationService configurationService, ServiceRegistry serviceRegistry) {
this.configurationService = configurationService;
this.serviceRegistry = serviceRegistry;
}
@Override
@ -64,4 +67,9 @@ public class TypeBeanInstanceProducer implements BeanInstanceProducer, TypeBoots
public Map<String, Object> getConfigurationSettings() {
return configurationService.getSettings();
}
@Override
public ServiceRegistry getServiceRegistry() {
return serviceRegistry;
}
}

View File

@ -4,6 +4,8 @@
*/
package org.hibernate.type.spi;
import org.hibernate.service.ServiceRegistry;
import java.util.Map;
/**
@ -18,6 +20,6 @@ import java.util.Map;
* @since 5.4
*/
public interface TypeBootstrapContext {
@SuppressWarnings("unused")
Map<String, Object> getConfigurationSettings();
ServiceRegistry getServiceRegistry();
}

View File

@ -106,7 +106,7 @@ public class BootstrapContextTesting implements BootstrapContext {
this.representationStrategySelector = ManagedTypeRepresentationResolverStandard.INSTANCE;
this.typeConfiguration = new TypeConfiguration();
this.beanInstanceProducer = new TypeBeanInstanceProducer( configService );
this.beanInstanceProducer = new TypeBeanInstanceProducer( configService, serviceRegistry );
this.sqmFunctionRegistry = new SqmFunctionRegistry();
}