Android does not happen much, but let’s take a look on Kotlin in other platforms. For example, take Rest-service, a classic Enterprise-solution.

For beginning, that’s my make-file (I deside to use gradle):

A few comments: using SpringBoot with Web, Mustache and H2 database plugins. Added plugin  kotlin-jpa for creating empty constructors in entity-objects. This need for Hibernate successful working.

Now starts. Running class is very simple:

Now writing entity-object. It wil be very simple for our example, but can support all dependencies, as complicated as you like:

Adding repository. Like using Java, it very minimalistic (for default CRUD-operations):

Now we going to business-logic. For some reason, I decided to do it according to my mind and immediately put the standard operations into a separate base class. These guys are:

Now adding controller. Since I’ve gotten breaking bad for the base class of the service, I’ll do the same trick here:

And tha’t all, folks. Run and enjoy. All code on my GitLab, since GitHub working strange today 🙁

Leave a Reply

Close Menu