HHH-11946 Configure the Configurable services in SessionFactoryServiceRegistryImpl

This commit is contained in:
Guillaume Smet 2017-08-25 17:51:16 +02:00 committed by Vlad Mihalcea
parent 67ccdae0f5
commit 345c0cce17
1 changed files with 5 additions and 2 deletions

View File

@ -9,10 +9,11 @@ package org.hibernate.service.internal;
import java.util.List;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.engine.config.spi.ConfigurationService;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.service.Service;
import org.hibernate.service.UnknownServiceException;
import org.hibernate.service.spi.Configurable;
import org.hibernate.service.spi.ServiceBinding;
import org.hibernate.service.spi.ServiceInitiator;
import org.hibernate.service.spi.ServiceRegistryImplementor;
@ -60,7 +61,9 @@ public class SessionFactoryServiceRegistryImpl extends AbstractServiceRegistryIm
@Override
public <R extends Service> void configureService(ServiceBinding<R> serviceBinding) {
//TODO nothing to do here or should we inject SessionFactory properties?
if ( Configurable.class.isInstance( serviceBinding.getService() ) ) {
( (Configurable) serviceBinding.getService() ).configure( getService( ConfigurationService.class ).getSettings() );
}
}
@Override