If you are getting the below exception during you start your spring boot application.

The application failed to start due to an exception org.springframework.boot.web.server.PortInUseException: Port 8081 is already in use

Step 1:

Open up cmd.exe (note: you may need to run it as an administrator, but this isn’t always necessary), then run the below command:

netstat -ano | findstr :<PORT>

(Replace <PORT> with the port number you want, but keep the colon)


The story will tell you about the design principle you should consider during your coding. The example will cover java.

Why you should be using solid principles? how you can connect these with your controller, handler, action, service, repository class in java.

Single Responsibility Principle

A class should have one, and only one, reason to change.

One class should only serve one purpose, this does not imply that each class should have only one method but they should all relate directly to the responsibility of the class.

All the methods and properties should all work towards the same goal. When a class serves…


This story will tell about the basic thing that will come into the mind of the developer when using spring bean.

What is actually spring bean? Is there any other naming convention used?

Spring bean is an object that forms your application's backbone and is managed by the Spring Ioc container.

How you use spring bean in your project?Most used annotation?

  • @Component: class-level annotation which by default denotes a bean with the same name as the class name with a lowercase first letter. It can be specified a different name using the value argument of the annotation
import org.springframework.stereotype.Component;@Component
public…


This story will explain the spring container and how its works

The org.springframework.beans and org.springframework.context packages are the basis for Spring Framework’s IoC container. The BeanFactory the interface provides an advanced configuration mechanism capable of managing any type of object. ApplicationContext is a sub-interface of BeanFactory.

Container Overview

The org.springframework.context.ApplicationContext the interface represents the Spring IoC container.

Instantiating a Container

The location path or paths supplied to an ApplicationContext constructor are resource strings that let the container load configuration metadata from a variety of external resources, such as the local file system, the Java CLASSPATH, and so on.

ApplicationContext context…


The story will tell you about the timeout or the configuration we need to know about implementing the ReplyingKafkaTemplate in your project.

ReplyingKafkaTemplate: KafkaTemplate that implements request/reply semantics. for more please visit https://shuaibabdulla40.medium.com/apache-kafka-request-reply-semantics-implementation-replyingkafkatemplate-5bf64958268c

When you have a replay topic is shared with multiple consumers you should be careful during the configuration of group id and sharedreplaytopic configuration.

As you could see above diagram, if your application is deployed in, for example, two-node, and was given the same group id, for example, group-node for both node1 and node 2 then the below cases may occur.

  • The request was initiated from Node1…

The story will tell about the scenario of the application failed to start due to an exception org. spring framework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type.

I will explain the one scenario that happens. As described in the image we have class One that implements interface A and class Two extend class B and interface B.

I have one action, facade, or handler component class where I need to invoke for service for two different purposes.

As per HandlerClass uses the @Autowired
private InterfaceA interfaceA;

@Autowired
private Interfaceb interfaceB.

Here we will get the compile-time error like Could not autowire there…


The story will explain how Kafka is working in a bit of depth.

What is Apache Kafka?

Apache Kafka is a horizontally scalable,fault-tolerant, distributed streaming platform.

  • Deliver the messages to consumers when they need them.

Kafka combines three key capabilities so you can implement use cases for event streaming end-to-end with a single battle-tested solution:

  1. To publish (write) and subscribe to (read) streams of events, including continuous import/export of your data from other systems.
  2. To store streams of events durably and reliably for as long as you want.
  3. To process streams of events as they occur or retrospectively.

And all…


This story is about the issue faced while developing when you want to connect your colleague Kafka server.

Issue

While trying to connect the Kafka tool will say unreachable to the Kafka server.

Steps to follow

As the Kafka config will contain the below structure.


This will tell you how you can manage your DB scripts in your project.

Applying Continuous Delivery means to automate the delivery pipeline and to release frequently. However, databases are a big challenge, because with every deployment we may need to update and migrate our database before we can deploy our application. This post points out solutions for dealing with databases in a Continuous Delivery scenario.

Folder structure

Folder and script names must start with an index number followed by an underscore and a description. The index indicates the sequence of the scripts or script folders.

The DBMAINTAIN_SCRIPTS table

The…


When you try to add multiple custom validation as below for reactive form in angular.

constructor(fb: FormBuilder, private cadastroService:CadastroService) {
this.signUp = fb.group({
"name": ["", Validators.compose([Validators.required, Validators.minLength(2)])],
"email": ["", Validators.compose([Validators.required, Validators.email])],
"phone": ["", Validators.compose([Validators.required, Validators.minLength(5)])],
"cpf": ["", Validators.required, ValidateCpf]
})
}

This code is in the file with the validation I want to implement:

import { AbstractControl } from '@angular/forms';export function ValidateCpf(control: AbstractControl){
if (control.value == 13445) {
return {errorCpf: true}
}
return null;
}

Solution

you have to add multiple validators in an array

. Example:

With Error

profileFormGroup = {
budget: [null, Validators.required, Validators.min(1)]
};

Above one…

Shuaib Abdulla

Java 8 | Spring | React | Angular | CI/CD | Microservices | Monitoring |Apache Kafka. https://www.linkedin.com/in/shuaib-kunhabdulla-83780188

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