Testing a Hypermedia REST API using Traverson

September 20, 2020 Joe

In the previous post, we discussed how to create hypermedia driven REST APIs using Spring HATEOAS. In this post, we will have a quick look at how to test the restful API we developed in that previous post using Traverson. Traverson is a Spring Hateoas component inspired by a similar JavaScript library that makes it easier to navigate hypermedia APIs by following links with relation types.

Read More..

Multiple Database Connection using Spring Data JPA

September 13, 2020 Joe

In this post, we will develop a simple Patient Management System using Spring Boot (spring-data-jpa), where the patient information is stored in a MySQL database and the medical record stored in a PostgreSQL database. The developed application should interact with both databases in real time and perform various database operations.

Read More..

Hypermedia Driven REST API With Spring HATEOAS

May 24, 2020 Joe

A software application is said to be RESTful if the engine of the application state is driven by hypertext (hypermedia). which means that it allows an extensive cross referencing between related data and ensures further operations will depend on the state of the resource.

Read More..

Spring HATEOAS - Adding Pagination Links To RESTful API

June 14, 2020 Joe

When a RESTful API returns a pageable result, it is a good practice to return the required pagination links to enable the clients to easily navigate all the available resources.

In this post, we will look at how to achieve this using PagedResourcesAssembler.

Spring data provides the org.springframework.data.web.PagedResourcesAssembler class which is an implementation ofRepresentationModelAssembler, PagedModel>> interface.

Read More..

Step by Step API Load Testing with Gatling

March 9, 2020 Joe

Gatling is a powerful load testing solution, written in Scala and built upon Netty (for non-blocking HTTP) and Akka (for virtual user(s) orchestration).

Gatling supports HTTP, JMS, WebSocket, Server-Sent-Events and can also be used to test JDBC connections. It integrates with most development pipelines (Maven, Gradle, Jenkins etc.) and also includes colourful HTML reports.

Read More..

Database Connection Pool in Spring

December 19, 2019 Joe

For most enterprise database intense application, the cost of creating new database connection, the network traffic will impact on the overall performance of the application without employing a database connection pooling pattern.

Database Connection pooling is a pattern used by software applications to connect to databases using already created set of reusable connection objects. The connection pool acts as a cache of the open database connections.

Read More..

Spring Boot Database Connection Pool

December 20, 2019 Joe

The Spring Boot looks up the classpath for the presence of any of the aforementioned connection pool implementations.

By default, Spring Boot uses HikariCP for the obvious reason which includes performance if found in the classpath. But falls back to Tomcat JDBC in the absence of HikarCP if Tomcat JDBC is present in the classpath.

Finally, in the absence of HikariCP and Tomcat JDBC, Spring Boot will choose Apache DBCP2 if present in the classpath.

To signal to Spring Boot our choice of connection pool implementation to use we need to do the following;

Read More..

Dependency Injection in Spring

April 7, 2020 Joe

In software engineering, traditionally, a custom piece of code controls its call to a reusable code or framework, however, with Inversion of control (IoC), it is the framework that calls into the custom piece of code

Inversion of control (IoC) is sometimes referred to as the "Hollywood Principle: Don't call us, we'll call you".  This implies that the application code does not control the creation of its dependencies.

Read More..

Java basics - Working with Files

January 5, 2020 Joe

A Path is a sequence of directory names, optionally followed by a file name. A Path could be relative or absolute. A Path that starts with a root (/ or C:\) component is absolute; otherwise, it's relative. A relative path needs to be combined with another path in order to access a file. 

        Path absolute = Paths.get("/", "home","hello");
        Path relative = Paths.get("myApp", "config","app.properties");
Read More..

Web API explained

October 6, 2019 Joe

An API enables two computer systems to communicate with each other by providing the language and contract on how the two systems will interact. A standard API will have specifications and instructions which determines how information can be transferred between two communicating computer systems.

Read More..