Security is no longer an afterthought, it's a must in any application these days.

Image for post
Image for post
Image Courtesy: https://unsplash.com/photos/-likB8H-IFk

In the modern era, security is an essential feature in any application, your REST services are no exception to it. In this short tutorial, we’ll discuss how to secure your REST APIs with BASIC authentication. We’ll use Spring Security to implement the security of the API

Application Endpoints

GET /pockets: Returns all available pockets

GET /pockets/{id}: Returns the available pocket for the supplied id. Return an error for invalid ids

POST /pockets: Create a new pocket

PUT /pockets…


Consume web services with Spring Boot and Spring Web Services.

Image for post
Image for post
Image Courtesy: Unsplash by Casey Horner

Spring Web services is an alternative way to develop document-driven, contract-first SOAP web services. One of the main reasons to use Spring-WS is that it has built-in Spring integration and features such as dependency injection.

In this article, we will demonstrate how to consume a soap web service with Spring boot.

What are we Building?

We are consuming a SOAP web service that provides Medium article details. This web service has only one operation named getArticle. The SOAP request message accepts an article ID of the article and returns the article details in the response. Following is the WSDL definition file:

article.wsdl

Complete source…


Build and Deploy a Spring Boot application in Wildfly Server through Maven

Image for post
Image for post
Image Courtesy: Unsplash by JOHN TOWNER

By default, Spring Boot applications are shipped with an embedded tomcat container and packaged as an executable UBER jar. This fat jar can be executed in console without the need for an application server. However, at times we need to package the application as a WAR file and deploy it into a web/application server. In this article, we will discuss how to package a Spring Boot application as a WAR file and deploy it into the WildFly application server.

Setting up WildFly Server

Let us first set up the WildFly application server. This server can be freely downloaded from the WildFly website. Based on…


Design document-driven, contract-first SOAP web services with Spring Boot and Spring Web Services.

Image for post
Image for post
Image Courtesy: Unsplash by ᴠɪᴋᴛᴏʀ ꜰᴏʀɢᴀcs

SOAP Web Services (Spring-WS) is an offering from Spring Framework that facilitates creating document-driven, contract-first SOAP web services. One of the main reasons to use Spring-WS is that it has built-in integration with Spring Framework and the ability to leverage major Spring features such as dependency injection. Also, the architecture of Spring-WS resembles that of Spring-MVC and this makes the learning of Spring-WS much easier.

In this article, we will develop a contract-first soap web service with Spring boot. In the development process, we will highlight the core Spring-WS features.

What are we Building?

We are developing a SOAP web service that let users…


Swagger let us document REST APIs and shares with API Users. It also allows us to generate REST stubs for quick prototyping and mocking

Image for post
Image for post
Image Courtesy: Unsplash by Andy Art

The popularity of REST Web service is ever-increasing and REST API based application design is the standard in the enterprise space. An API defines a contract between the API publisher and its consumers. This contract includes several aspects of the API; including the endpoints, request-response model, domain objects and so on. Over the last couple of years, Swagger has emerged as the standard to document the REST APIs. Swagger captures the API definitions in JSON or YAML format adhering to the OpenAPI specification. A Swagger document can be shared with API consumers for quick prototyping and mocking.

Swagger also provides…


Functional programming in Java in a better way.

Image for post
Image for post
Image Courtesy: Unsplash by Daryan Shamkhali

Java has introduced functional programming support in Java release version 8. This specific release has also introduced several new concepts notably lambda expressions, method reference and a plethora of functional interfaces. While discussing functional interfaces, there are few functional interfaces namely Consumer, Supplier, Predicate and Functions are most crucial. In this article, we will talk about these interfaces.

Consumer

A Consumer is a functional interface that accepts a single input and returns no output. In layman’s language, as the name suggests the implementation of this interface consumes the input supplied to it. Consumer interface has two methods:

void accept(T t); default…


Most frequently used core annotations in Spring application development

Image for post
Image for post
Image Courtesy: Unsplash by the_roaming_platypus

Introduction of annotation in Java programming language has changed the way Java developers used to configure their applications. Its introduction in Java 1.5 has empowered application developers to maintain configurations in the source code itself instead of relying on external configuration files. It is a form of syntactic metadata that can be added to Java Source code classes, methods, variables, parameters and packages.

Spring framework let application developer configure applications with a plethora of in-build annotations. In this article, we will focus on a few most frequently used annotations in Spring Core framework.

#1. @Autowired Annotation

This annotation is used to declare a…


Securing an application with Transport Layer Security and a Self-Signed Certificate

Image for post
Image for post
Image Courtesy: PixaBay

Security is an important aspect of any application and nearly all production-grade applications employ a certain level of security mechanism for application security. Transport Layer Security allows applications to develop a secure communication channel with its clients. In this article, we will create a Spring boot application and secure it with a self-signed certificate.

Creating a Spring Boot Application

In this section, we will create a Spring boot application and expose the following endpoints:

GET v1/books/ : List all books
POST v1/books/: Create a new book
GET v1/books/{book_id}: Get a book resource
DELETE v1/books/{book_id}: Remove a book

Step 1: Creating a Spring Boot Project


Dropwizard is a Java framework for developing operations-friendly, high-performance, RESTful web services

Image for post
Image for post

Dropwizard is a Java framework to develop RESTful web services. It pulls together mature and stable libraries from the Java ecosystem into a lightweight, simple package that let's build production-grade applications. It also provides out-of-box support for configuration, application metrics, logging, and other operational tools.

The most interesting part of Dropwizard is its selection of libraries in order to perform the job. It pulls together best-of-the-class libraries from each domain and let the application developer focus on their task.

Notable Libraries

Dropwizard uses a plethora of libraries to provide various services in a traditional Dropwizard application. Following are a few critical selections:

Jetty for HTTP


Creating scalable, flexible and robust APIs with MERN stack

Image for post
Image for post
Image Courtesy: Unsplash by Nghia Le

Node JS is a JavaScript runtime built on top of Chrome’s V8 JavaScript engine and allows the use of JavaScript on the server-side. Express JS a minimal and flexible web framework build on top of Node JS with a plethora of features to develop web and mobile applications. MongoDB is one of the most popular document-based, NoSQL database. Together these three technologies facilitate building a highly flexible, scalable and robust application.

In this article, we will talk about how to design an application leveraging these technologies.

Our Application

In this article, we will develop a RESTful API with the aforementioned technologies. We…

Somnath Musib

Full Stack Developer ★ Technical Writer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store