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?
Category: Spring Boot
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 2
In the PART 1 of this blog series, we deployed a PostgreSQL database on minikube. In this part, we will deploy spring boot application . I have mentioned in PART 1 , how to dockerize and upload the order service to docker registry. The application.properties of the service , will get the details of database … Continue reading Setup of spring boot application & initialization of PostgreSQL database on Kubernetes – PART 2
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
Containers and Developer Experience – 2
In the previous blog i shared how Jib, an open source tool maintained by Google accelerates the development of docker images for java based application.But if you are doing deployment in a Kubernetes environment then you should try Skaffold, another open source container tool from google which simplifies common operational tasks that you perform when … Continue reading Containers and Developer Experience – 2
Containers and Developer Experience
Packaging and shipping software as containers has numerous benefits, but doing it without the right tools and techniques leads to poor developer experience.Some of the challenges that i faced are: Local Installation of Docker : Getting Docker installed with root account or account with root privileges has been a challenge due to organizations security policies and this had … Continue reading Containers and Developer Experience
Java microservices with GraalVM
Microservice is a trending and popular architecture to build applications as it allows organizations to be agile and adopt DevOps and continuous testing practices.Spring Boot is a very popular technology choice to build java based microservices, but it consumes a good amount of memory and spring's runtime reflection approach leads to longer startup times as … Continue reading Java microservices with GraalVM
What is JWT and why do we need it in a microservices based application?
JWT (JSON Web Token) is a very popular way to do user authorization in microservices. It is a standard which is used to create access tokens for an application and enables secure communication between between two parties. The Industry standard specification RFC7519 outlines how information in JWT should be structured. It is widely used in … Continue reading What is JWT and why do we need it in a microservices based application?
Execute multi-container applications (Spring boot & PostgreSQL)
Use Case Run a dockerized spring boot application which has dependency on PostgreSQL docker containerInitialize the database with data while its getting createdMount an external volume so that the data does not get lost when container exits Solution:Step 1: Build a micro service using spring boot to be containerizedClone the following spring boot implementationhttps://github.com/rajeshsgr/order-svcThe example … Continue reading Execute multi-container applications (Spring boot & PostgreSQL)