• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Spring Data JPA CrudRepository  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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
Java Oracle Ruby
  • Mark post as helpful
  • send pies
  • 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
  • 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]
 
I will open the floodgates of his own worst nightmare! All in a tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!