Your question is not entirely clear to me but it sounds like you want to create a Java Delegate that when it is executed as a task within your workflow, it will be able to pull in some data from a database?
If you want to create a Spring managed Java Delegate, you can follow the directions given here: Spring beans not injected into Flowable context - #12 by jwashington. The delegate can be injected with whatever Spring dependencies you need from within the Spring Boot app.