It is given : there was a task of writing a simple REST API consisting of literally several methods. We submit several parameters to the input, JSON output. There is no need to work through the browser, that is, no pages of beautifully displaying all this are required (can it then even more correctly be called a Веб-сервисом ?). The load is assumed to be small.

Naturally need any authorization. The following pattern has developed in my head: upon successful authorization, a token is transmitted to the user, which is subsequently transmitted with each request to the API. On the backend, respectively, check this token.

What I have :

  • since Java is closest to me, the choice fell on it;
  • build maven ;
  • Spring was chosen as the framework;
  • Apache Tomcat v8 server;
  • current MSSQL database.

The question is : to what extent is this technology stack suitable for solving such a problem, is this not "gunning at sparrows"?

Somewhere I heard that Tomcat does not support Java EE, or does not fully support it, is it?

The question is of course a common one, but I would like to know your opinion, which would obviously not go a false way.

Thanks in advance for your reply.

PS: I heard about Node.js , but somehow it didn’t work out for technical reasons) Or maybe you don’t have to bother with PHP )

    1 answer 1

    Yes. Tomcat is just a servlet container and is in fact not a J2EE server, because does not implement all necessary EE specifications. But you don’t need them if you use the Spring framework.

    The technologies chosen by you are quite suitable for solving your problem.

    I also advise you to use Spring Boot for easy configuration, which will provide you with many ready-made features. To work with the database, pay attention to the Spring Data-JPA .

    In your case, you can even further simplify the solution using Spring Data-Rest

    An example of how you can create a simple RESTfull web service on Spring Data-Rest and Spring Boot in 15 minutes.

    • thanks for the answer. Yes, just the same at the moment torment Spring Boot. But tell me about all sorts of Spring Data-JPA and Spring Data-Rest, I pull only stored procedures from the database, and in all tutorials, it is the database tables that are manipulated. In that case, I probably don't need to use these technologies? - droid
    • @droid If you plan to use JPA at all then you can pull the storage from the Spring repositories simply by hanging the corresponding. annotation (see jpa.stored-procedures ). In my opinion it is very convenient, beautiful and concise. Otherwise (without JPA) you can use the more low-level version of co Spring JDBC - rvit34
    • yes, thanks. - droid