What is a spring bean and is it different from Java class?

Spring beans and Java classes are both objects in Java, but they have different characteristics and are used for different purposes. A Spring bean is an object that is managed by the Spring Framework. This means that the Spring Framework is responsible for creating, configuring, and destroying the bean. Spring beans are typically used to … Continue reading What is a spring bean and is it different from Java class?

How do i check logs of a docker container ?

To demonstrate this, i have a sample spring boot application which prints log every 1000 milliseconds (1 second) @RestController public class RandomLoggerResource { private static final Logger logger = LoggerFactory.getLogger(RandomLoggerResource.class); private Random random = new Random(); @Scheduled(fixedRate = 1000) public void logRandomMessage() { int randomInt = random.nextInt(); String randomMessage = "Generating a Random integer every … Continue reading How do i check logs of a docker container ?

How do you add custom response headers in a Spring Boot application?

To add custom response headers in a Spring boot application use ResponeEntity class. Set the values using HttpHeader object. Set the header object in response entity To set a response header for all the response , implement a Filter class and set the header in the ServletResponse class Code Snippet @Component public class ResFilter implements … Continue reading How do you add custom response headers in a Spring Boot application?

Setup of spring boot application & initialization of PostgreSQL database on Kubernetes – PART 1

How to deploy a containerized spring boot application , with PostgreSQL as database on minikube. This post will also share details on how to initialize the database with tables and data during the initialization process. Will use a spring boot application order service with a REST endpoint to fetch customer details GET /customers It uses … Continue reading Setup of spring boot application & initialization of PostgreSQL database on Kubernetes – PART 1

Spring Boot Toggle Feature using Togglz

Feature toggle is a design pattern used to hide, enable or disable a feature during runtime. For example, during the deployment, a developer can disable the feature in the code which is released to production and enable it later in the next iterations when its 100% ready or enable the feature for testing to limited … Continue reading Spring Boot Toggle Feature using Togglz

Lifecycle of a request and response process for a SPRING REST API

Developing a REST API using Spring Boot framework accelerates the development process, and allows API developer to only focus on writing the core business logic. However understanding the end to end  a request life cycle will help the developers to understand the overall process and behind the scene activities done by Spring, to debug and … Continue reading Lifecycle of a request and response process for a SPRING REST API