Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

org.springframework.beans.factory.BeanCreationException: Error creating bean with name...

 
Josep M Serrainat
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, i have this structure

...dao


...dao.jpa





...dao.jpa.impl



in applicationContext.xml



When run with mvn tomcat:run-war, i get this error



I investigate where's the problema, but .... i don't find nothing. Can help me please.
Thank's for all and regards.
 
Srinivas Kollaparthi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class UserDaoImpl has no default constructor. It has a single parameterized constructor.

But In Context xml, you defined 'userDao' bean with no contructor argument.

Add a proper constructor argument to bean 'userDao'.
 
Josep M Serrainat
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srinivas,
Thanks for response. I'm newer with it. How can i add a proper constructor argument to bean?

 
Srinivas Kollaparthi
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this :



Spring at run time will see that the constructor formal parameter is a Class, and it will so auto-magically inject as the constructor actual parameter the result of the invokation of Class.forName("cat.innoments.s2.model.User").

The above config should work.

Another approach :

 
Josep M Serrainat
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Srinivas ,
Thanks for all.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Spring; this has nothing to do with Struts.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic