Java Spring boot code to fetch data from postgres

I want a java spring boot code for fetching data from different tables present in different schemas of postgres database. I need this question to be answered for service task point of view as well as User task’s Task Listener point of view.