Developing RESTful APIS with the Platform: Low-Code vs. Spring Boot


Introduction

The goal of this tutorial is to show the support tha the Platform offers for the development of REST APIs, so that the Platform can be used as a Low-Code platform or as a tool that supports the development of APIs with one of the most used technologies for this: Spring Boot.

With this, we will demonstrate that the Platform offers the developer a set of very interesting features to approach their project:

  • Agile development: all the pieces that make up a development are managed and handled from a single web environment, with graphical tools offered to eliminate or minimise development.
  • Business-Centric Development: the programmers can build complex systems, isolation themselves from the complexities of the underlying technology.
  • Software lifecycle management: the platform covers all phases, from development to deployment,
  • Development on open-source components: widely used in enterprise development. Virtually standard in its field, such as Spring Boot, Kafka, MongoDB, Elasticsearch,...
  • Flexible development: the Platform allows the programmers to select which pieces of the platform they want to use. These pieces join a traditional development.


One subject to highlight is the Platform's flexibility, as it allows programmers to use different approaches, as we will show next, and even use mixed approaches in which certain parts can be developed with visual platform environmentsm and others with a more traditional approach,

It will be the technical team's responsibility to decide which is the most suitable approach for their project, depending on the expertise of the team, time for development, etc.

How to follow the tutorial?

As we said at the beginning, we are going to show how to develop a REST API (and everything around this concept, such as versioning, lifecycle, deployment, security and integration with Javascript UI) following the Low-Code Platform approach and using the platform together with a Spring Boot development.

For this purpose, 2 entries have been created, one for each approach.

Como decíamos al principio, vamos a mostrar cómo se haría el desarrollo de un API REST (y todo lo que hay alrededor de este concepto, como el versionado, ciclo de vida, despliegue, seguridad a integración con UI Javascript) siguiendo el enfoque Low-Code de Plataforma y usando plataforma junto a un desarrollo en Spring Boot.

Para ello se han creado 2 entradas, una para cada aproximación.

Both entries follow these steps:

  1. Preparing the Environment for Development.
  2. API development with Onesait Platform and Spring Boot for message delivery: 
    1. API functionality.
    2. Defining the Message Resource and creating the API interface.
    3. Testing the API with Swagger.
    4. Extending the API functionality so that it sends an email.
  3. Integrating security into your API: authentication.
  4. Completing API functionality.
  5. Deploying your API.
  6. Managing the API lifecycle from API Portal.

INFO

The code for this example is available in this Github repository: https://github.com/onesaitplatform/onesaitplatform-spring-boot-example

Comparing times

In this section, we will analyse the time required for the development of the functionality following the LowCode approach, the approach that uses Spring Boot in addition to Platform, and a third approach in which we do not use any of the platform capabilities for development and deployment.

We also compare the expertise needed by the person doing the development.


Platform Development, Low Code Approach
Platform Development + Spring Boot
Spring Boot development without the Platform
1. Preparation of the Development Environment

1.1. Provisioning in Onesait Platform Environment (0h if use Lab / 1h installation in E. Development)

1.1. Installation of Tools: Platform SDK + Docker + MongoDB (docker/bin) (1h)

1.1. Tools installation: JDK, Maven, IDE (Eclipse...) , MongoDB (docker/bin) (2h)

1.2. Registration of developer-type user in the platform, for access to tools/modules (5m)

1.2. Creation of Spring Boot project with Microservices support: baseline structure, necessary dependencies, configuration properties (connections, etc.) (30m)

1.2. Creation of the Spring Boot project: baseline structure, necessary dependencies, configuration properties (connections, etc) (30m)

TASK 1 TIME

Expertise

~1h

Junior User/Developer

~1h 30m

Java Developer

~2h 30m

Java Developer


2. Development of an API with message sending






2.1. Entity (Ontology) creation (5m)

2.1. Spring Data entity creation (15m)

2.1. Spring Data entity creation (15m)

2.2. Creation of the API, with custom operations in SQL language (15m)

2.2. Creation of operations on the entity with Spring Data

2.2. Creation of operations on the entity with Spring Data

2.3. Swagger definition: already given automatically by the Platform (0m)

2.2.1 Creation of the Repository layer, with custom operations not provided by the Spring Data interface (2h)

2.2.1 Creation of the Repository layer, with custom operations not provided by the Spring Data interface (2h)

2.4. Mail sending functionality on insertion: using Flow Engine (15m)

2.2.2. Creation of the REST controller and underlying service (1h)

2.2.2. Creation of the REST controller and underlying service (1h)


2.3. Swagger documentation with Swagger Springfox (30m)

2.3. Swagger documentation with Swagger Springfox (30m)

2.4. Send mail on insertion with Spring Boot Mail Services

2.4. Send mail on insertion with Spring Boot Mail Services

2.4.1. Mail configuration class + properties (15m)

2.4.1. Mail configuration class + properties (15m)


2.4.2. Java Service + existing code adaptations (30m)

TASK 2 TIME

Expertise

~30m

Junior Developer

~4h 30 m

Advanced Java Developer

~4h 30 min

Advanced Java Developer


3. API Securisation

The Platform already integrates security with OAuth2 and API token, simple configuration (0min)

3.1. Use Onesait Platform security library for Spring Boot applications

3.1. IntegrateAPI security with Spring Boot


3.1.1. Configuration classes + API access configuration (30min)

3.1.1. Configure security repository (DB, LDAP, files,...) (1h)


3.1.2. Add login service to the API (30min)

3.1.2. Configuration classes + configuration of the API access (30m)



3.1.3. Add login service to the API (30min)

TASK 3 TIME

Expertise

0m

Junior Developer

~1h

Junior Java Developer

~2h

Advanced Java Developer


4. Completing functionality: sending SMS

4.1. Publish the SMS service provider's REST API in the API Manager, encapsulated in a Swagger2/OpenAPI3 descriptor (30m)

4.1. Use the service provider's JDK

4.1. Use the service provider's JDK

4.2. Modify the Flow Engine's flow to invoke this API (15m)

4.1.1. Configure the SMS service (15m)

4.1.1. Configure the SMS service (15m)

4.1.2. SMS sending Java service + modification of existing functionality (45m)

4.1.2. SMS sending Java service + modification of existing functionality (45m)

TASK 4 TIME

Expertise

~45m

Junior Developer

~1h

Junior Java Developer

~1h

Junior Java Developer


5. Basic integration tests

5.1. Basic REST testing tool, Postman-type: test all API operations (1h)

5.1. Spring Boot Test + JUnit: test all operations with different input cases (1h)

5.1. Spring Boot Test + JUnit: test all operations with different input cases (1h)

TASK 5 TIME

Expertise

~1h

Junior Developer

 ~1h

Java Developer

 ~1h

Junior Java Developer






6. API Deployment

The Platform already deploys the API and makes it available in the API Manager

6.1. Containerisation of the application via Microservices Support: Dockerfile (0m)

6.1. Application containerisation: Dockerfile (15m)


6.2. Upload code to Git repository (0m)

6.2. Image generation: Git repository, Jenkins, Docker Registry (1h)



6.3. Deploy the application as a microservice on platform: configuring Gitlab +jenkins +CaaS (15m)

6.3. Deploy the application on Kubernetes/CaaS (15m)



6.4. Publishing the Swagger interface of your deployed microservice in the API Manager as an external API (15m)


TASK 6 TIME

Expertise

0m

Junior Developer

~30min

Junior Java Developer

~1h 30min

Developer Java Advanced


TOTAL DEVELOPMENT TIME~3h 15m~9h 30m12h 30m
EXPERTISEJunior DeveloperDeveloper JavaDeveloper Java Advanced

Conclusions