从Spring 3.2开始,将忽略LocalContainerEntityManagerFactoryBean上的lazy-init =“true”

时间:2014-08-23 13:29:59

标签: spring hibernate spring-3

从Spring 3.2开始,LocalContainerEntityManagerFactoryBean上的set lazy-init =“true”将被忽略。我已经从Spring 3.0移植到3.2的应用程序。 LocalContainerEntityManagerFactoryBean的延迟初始化在Spring 3.0中运行良好,但在3.2中不行。

<bean id="entityManagerFactory" 
   class="de.gillardon.base.hibernate.internal.EntityManagerFactoryBean" 
   lazy-init="true">
    <property name="persistenceProviderClass" 
              value="org.hibernate.ejb.HibernatePersistence"/>
    <property name="dataSource" ref="dataSource"/>
    <property name="jpaProperties" ref="jpaProperties"/>
</bean>

我认为对于Spring v3.2.0.RC1,CS https://github.com/spring-projects/spring-framework/commit/3c59725b94faef83bbc3ca5d48f955aabe6ff9d0引入了更改。

org.springframework.context.support.AbstractApplicationContext.
finishBeanFactoryInitialization(ConfigurableListableBeanFactory)
...
// Initialize LoadTimeWeaverAware beans early to allow for registering their transformers early.
String[] weaverAwareNames = beanFactory.getBeanNamesForType(LoadTimeWeaverAware.class, false, false);
for (String weaverAwareName : weaverAwareNames) {
    getBean(weaverAwareName);
}

当LocalContainerEntityManagerFactoryBean实现LoadTimeWeaverAware时,即使lazy-init = true,它也会被初始化。这是预期行为还是错误?我在文档中找不到任何关于此行为的提示。

0 个答案:

没有答案