title: Getting database connection in Spring Batch service classes
body: <p>I have a few cases where I want to get a connection to a configured database in a Spring Batch service class, for example in a processor or a custom writer.  I can inject the data source into my class but I want to get a connection to it.  The out of the box Spring Batch database readers and writers automagically get a connection so I want to use that rather than write my own connection code.  So in the writer example say my class uses ItemWriterAdapter and in it I need to do a query.  How can I grab an established connection to a configured data source?  </p>