Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Couldn't find a destroy method named 'close' on bean with name 'dataSource'

 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am developing my first Spring app and I came with the following warning:


Here is a snippet from my spring config file corresponding to this warning:

Can anyone please advise what to do about it? By the way I use Mysql and Jpa and Hibernate as jpa implementation.

Should I worry about it?
Thanks in advance,
Julien.
 
Alaa Nassef
Ranch Hand
Posts: 471
Hibernate Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The destroy-method="close" is needed when you are using apache commons DBCP's BasicDataSource or C3P0's ComboPooledDataSource to shutdown the data source immediately when the spring application shuts down. This is not needed in the DriverManagerDataSource. This class doesn't even have any form of destroy method. Spring manages that for you. Just remove the destroy-method attribute from your bean definition.
 
Julien Martin
Ranch Hand
Posts: 384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will do.
Thanks a lot!
Julien.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic