Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.0 + Hibernate JPA Implementation - Autowiring not working Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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??

  • #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.

    Comment


    • #3
      You leave out the most important bit.... The actual code and configuration...

      Comment

      Working...
      X