Example of using multiple persistence units with Spring?
Issue
-
The following
BeanCreationExceptionis encountered when deploying my Spring based application:2010-08-30 09:49:51,155 ERROR [com.example.SomeBean] Unable to start Spring Context org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aBean' defined in class path resource [META-INF/applicationContext.xml]: Cannot resolve reference to bean 'someDao' while setting bean property 'someDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'someDao': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.persistence.EntityManagerFactory] is defined: expected single bean but found 2 at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) ...
Environment
- JBoss Enterprise Application Platform (EAP) 4.3
- Spring 3.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
