-
Mar 26th, 2011, 11:11 PM
#1
Spring 3.0 + Hibernate JPA Implementation - Autowiring not working
I am stuck on this issue. I have a simple DAO test case to test out its features. I am persisting objects using JPA Context injection. Initially, I tried to use @Autowire annotation but then I ended up getting "Cannot autowire field" exception.
As a work around I tried to reference ApplicationContext manually, but later found my EntityManager remains null. I am stuck on this issue. I am pretty sure it's a very simple fix (perhaps configuration) but not sure what.
Any recommendations/guidance??
-
Mar 26th, 2011, 11:55 PM
#2
ApplicationContext different when Web App is run in contrast to a single Test Class
The DAO works if I run the web application. The issue seems to be occurring only when I run a single test class. So when I run this test class, it can't find the autowired bean. So it seems like the ApplicationContext is built differently when the Web App is actually run. And since I'm not running the whole app but just a single test case, the ApplicationContext doesn't include all the beans.
-
Mar 27th, 2011, 11:31 AM
#3
You leave out the most important bit.... The actual code and configuration...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules