Chris, jbaruch, thanks for your answers.
jbaruch, I've ready your previous threads where you talked about setting JPA with JavaConfig. There were helpful. I did try defining EntityManagerFactory bean the way you've shown here in the thread, and I am currently bootstrapping JavaConfig with XML. The problem is that it seems that the beans defined in JavaConfig are not available to beans defined in XML files, or at least not available at the right time.
For instance, I have tried defining entityManagerFactory and TransactionManager beans in JavaConfig and leaving tx:annotation-driven in XML config. I include JavaConfig into XML as follows
Code:
<!-- JavaConfig configuration beans and post-processor -->
<bean class="org.finra.hpw.config.ApplicationConfig"/>
<bean class="org.springframework.config.java.process.ConfigurationPostProcessor"/>
When I try to load Spring application context with ClassPathXmlApplicationContext I get the following exception
Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot create inner bean '(inner bean)' of type [org.springframework.transaction.interceptor.TransactionInterceptor] while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:230)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'transactionManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'transactionManager' is defined
jbaruch, are you also using a mix of XML and JavaConfig for JPA or did you manage to get the entire config with JavaConfig?
Chris, can I help you guys with the example or tx:annotation-driven implementation?