• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring Data JPA CrudRepository

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello I am having some problem while running this . I am getting the following exception . I am trying out the following example CrudRepository for Spring Data, and I face the following


Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helloCntrl': Unsatisfied dependency expressed through field 'test'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.joydeep.springboot.Test1' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}


 



     


   



 
Greenhorn
Posts: 22
Oracle Ruby Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Configure a class with @Repository to enable scanning of Repository classes.

@Repository(basePackages = { "Provide the package name to scan for repositories "})
public class RepositoryScanning{

}

Add the RepositoryScanning class to the RootApplicationContext
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Joydeep Bhattacharjee

You are suppose to use @Repository anotation in your repository class and also use @service anotation in your service class.


You need to enable autowire in context.xml according to your configuration

   <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor" />

[there is no need to configure @autowire (required=true) in your class]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic