Skip to content

Commit 1027693

Browse files
committed
avoid use of BootstrapServiceRegistryBuilder in MockSessionFactory
so we don't need to go locating and instantiating unnecessary services
1 parent e0c81b9 commit 1027693

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/MockSessionFactory.java

+9-2
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
2222
import org.hibernate.boot.model.relational.Database;
2323
import org.hibernate.boot.model.relational.SqlStringGenerationContext;
24-
import org.hibernate.boot.registry.BootstrapServiceRegistryBuilder;
2524
import org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl;
2625
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
2726
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
27+
import org.hibernate.boot.registry.internal.BootstrapServiceRegistryImpl;
2828
import org.hibernate.boot.registry.internal.StandardServiceRegistryImpl;
29+
import org.hibernate.boot.registry.selector.internal.StrategySelectorImpl;
2930
import org.hibernate.boot.spi.BootstrapContext;
3031
import org.hibernate.boot.spi.EffectiveMappingDefaults;
3132
import org.hibernate.boot.spi.MappingDefaults;
@@ -186,7 +187,13 @@ public Class<?> classForName(String className) {
186187
}
187188
};
188189
serviceRegistry = StandardServiceRegistryImpl.create(
189-
new BootstrapServiceRegistryBuilder().applyClassLoaderService( classLoaderService ).build(),
190+
new BootstrapServiceRegistryImpl(
191+
true,
192+
classLoaderService,
193+
new StrategySelectorImpl( classLoaderService ),
194+
() -> emptyList()
195+
),
196+
// new BootstrapServiceRegistryBuilder().applyClassLoaderService( classLoaderService ).build(),
190197
singletonList(MockJdbcServicesInitiator.INSTANCE),
191198
emptyList(),
192199
emptyMap()

0 commit comments

Comments
 (0)