File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Couldn't find a destroy method named 'close' on bean with name 'dataSource' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Couldn Watch "Couldn New topic
Author

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

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
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

Joined: Jan 28, 2008
Posts: 460
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.


Visit my blog: http://jnassef.blogspot.com/
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Will do.
Thanks a lot!
Julien.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Couldn't find a destroy method named 'close' on bean with name 'dataSource'
 
Similar Threads
Spring Framework + JPA and many database schemas
XML name space error in Spring data JPA hibernate applicationContext.xml
how to add dditional properties to DB url in Spring ?
Spring - Connection Problem in some Unit Tests
How to Configure SSL over Database in Spring?