List of usage examples for org.hibernate.resource.beans.spi BeanInstanceProducer produceBeanInstance
<B> B produceBeanInstance(Class<B> beanType);
From source file:org.springframework.orm.hibernate5.SpringBeanContainer.java
License:Apache License
private SpringContainedBean<?> createBean(Class<?> beanType, LifecycleOptions lifecycleOptions, BeanInstanceProducer fallbackProducer) { try {//from w ww .java2 s . c o m if (lifecycleOptions.useJpaCompliantCreation()) { return new SpringContainedBean<>(this.beanFactory.createBean(beanType, AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false), this.beanFactory::destroyBean); } else { return new SpringContainedBean<>(this.beanFactory.getBean(beanType)); } } catch (BeansException ex) { if (logger.isDebugEnabled()) { logger.debug("Falling back to Hibernate's default producer after bean creation failure for " + beanType + ": " + ex); } return new SpringContainedBean<>(fallbackProducer.produceBeanInstance(beanType)); } }