I have a nodejs server application that provides API. Due to some client issues, we need to implement the same server using java. In node server, for GET or POST we simply execute SQL, GET or POST data to database using JSON. But in Java, I have seen using spring boot, I have to create a Bean class and in my controller return a List in @GetMapping.
For all my APIs, I would have to create so many beans. Can I return data just like in nodejs, executing SQL query, getting and returning JSON data as it is in Java? Also, if possible, is this approach recommended or the creating Bean approach is better? I am new to java so, have less idea about this.