HHH-13935 Allow subclasses of StandardServiceRegistryBuilder to initialize a custom list of StandardServiceInitiator(s)

This commit is contained in:
Sanne Grinovero 2020-04-06 14:56:40 +01:00
parent 9bb76a5cca
commit 6ea9844874
1 changed files with 20 additions and 1 deletions

View File

@ -71,7 +71,7 @@ public class StandardServiceRegistryBuilder {
public static final String DEFAULT_CFG_RESOURCE_NAME = "hibernate.cfg.xml";
private final Map settings;
private final List<StandardServiceInitiator> initiators = standardInitiatorList();
private final List<StandardServiceInitiator> initiators;
private final List<ProvidedService> providedServices = new ArrayList<>();
private boolean autoCloseRegistry = true;
@ -110,6 +110,24 @@ public class StandardServiceRegistryBuilder {
this.configLoader = new ConfigLoader( bootstrapServiceRegistry );
this.settings = settings;
this.aggregatedCfgXml = loadedConfig;
this.initiators = standardInitiatorList();
}
/**
* Intended for use exclusively from Quarkus boot-strapping, or extensions of
* this class which need to override the standard ServiceInitiator list.
* Consider this an SPI.
*/
protected StandardServiceRegistryBuilder(
BootstrapServiceRegistry bootstrapServiceRegistry,
Map settings,
LoadedConfig loadedConfig,
List<StandardServiceInitiator> initiators) {
this.bootstrapServiceRegistry = bootstrapServiceRegistry;
this.configLoader = new ConfigLoader( bootstrapServiceRegistry );
this.settings = settings;
this.aggregatedCfgXml = loadedConfig;
this.initiators = initiators;
}
/**
@ -124,6 +142,7 @@ public class StandardServiceRegistryBuilder {
this.bootstrapServiceRegistry = bootstrapServiceRegistry;
this.configLoader = new ConfigLoader( bootstrapServiceRegistry );
this.aggregatedCfgXml = loadedConfigBaseline;
this.initiators = standardInitiatorList();
}
public ConfigLoader getConfigLoader() {