Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

10
  • Works for me (taking a JPA bare bones project and converting to WAR). Does your app work if you remove the @EnableJpaRepositories (which should be automatic)? Or if you use an embedded databae (just trying to pare it down to an essence of failure)? How did you define your @Repository? Commented Nov 21, 2013 at 17:11
  • @DaveSyer If I remove @EnableJpaRepositories fails with: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.yyyy.xxxx.ui.persistence.repository.UserRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, lookup=, authenticationType=CONTAINER)} UserRepository is an Interface extending CrudRepository. Commented Nov 22, 2013 at 2:35
  • CrudRepository is pretty basic so shouldn't be any problem. If repositories are not being created that means you haven't done a @ComponentScan on the packages that contain the interfaces. Without the whole project it's hard to know if that will fix everything but it should get you closer. Commented Nov 22, 2013 at 11:32
  • @DaveSyer If I implement a custom JpaConfig that returns beans of type EntityManager and others, the war launches successfully. But when I rely on auto configuration as you suggested here the repositories are not loaded! Any suggestions? Commented Nov 25, 2013 at 6:24
  • I need to see the code. Can you push it to github or dropbox or somewhere? Commented Nov 25, 2013 at 7:40