What do you mean your own datasource? Do you want to implement the DataSource interface in a custom datasource class?
Otherwise you just configure it in your xml file using one of Springs DataSource classes. www.springframework.org has the documentation in Core Spring.
Prav Chau wrote:Yes, Basically I want to create custom Datasource which I can pass to Hibernate or JDBC through spring.
OK, I am still confused at what you want.
You plan on doing this???
public class MyCustomDataSource implements DataSource {...}
If so, I must ask why you want to do this? I would never do this, since others have created better DataSource objects than I could ever create.
The only reason why you might do this yourself is if you are creating Spring Framework or creating your own App Server. Otherwise, just use the ones that they created.
But if you do want to do it, then you just create a class that implements the DataSource interface. Then in Spring when you declare your datasource bean, you just have the class attribute point to your class you created. It is just the same as if you used someone else's DataSource class.