Couldn't find a destroy method named 'close' on bean with name 'dataSource'
Julien Martin
Ranch Hand
Joined: Apr 24, 2004
Posts: 383
posted
0
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
posted
0
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.