5.3.3. Boot-Strap Registry
5.3.3.1. 关于 Boot-strap Registry 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
boot-strap 注册表存放绝对必须可用的服务,大多数操作都必须可用。这里的主要服务是 ClassLoaderService,这是一个完美的例子。即使解析配置文件也需要访问类加载服务,如资源查找。这是通常使用的根注册表,而不是父注册表。
boot-strap 注册表的实例使用 org.hibernate.service.BootstrapServiceRegistryBuilder 类构建。
Using BootstrapServiceRegistryBuilder
示例:使用 BootstrapServiceRegistryBuilder
BootstrapServiceRegistry bootstrapServiceRegistry =
new BootstrapServiceRegistryBuilder()
// pass in org.hibernate.integrator.spi.Integrator instances which are not
// auto-discovered (for whatever reason) but which should be included
.with(anExplicitIntegrator)
// pass in a class loader that Hibernate should use to load application classes
.with(anExplicitClassLoaderForApplicationClasses)
// pass in a class loader that Hibernate should use to load resources
.with(anExplicitClassLoaderForResources)
// see BootstrapServiceRegistryBuilder for rest of available methods
...
// finally, build the bootstrap registry with all the above options
.build();