SPRING CORE / NOTES</>↗Spring Core15 Jul 2025
To implement lazy initialization and conditional bean loading in a Spring Boot application, you can make use of several Spring features. Here’s a breakdown of both concepts: Lazy Initialization Lazy initialization ensures that a Spring bean is not loaded into the application context until it is explicitly required. This can help to optimize startup time […]
SPRING BOOT / NOTES</>↗Spring Boot14 Jul 2025
To get started with Spring Data JPA and Hibernate in a Spring Boot application, follow these steps: 1. Add Required Dependencies Include spring-boot-starter-data-jpa and h2 (or any other database) dependencies in your pom.xml (for Maven projects). Maven: <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-star...
SPRING CORE / NOTES</>↗Spring Core13 Jul 2025
Integrating Spring’s Inversion of Control (IoC) container with non-Spring-managed objects can be useful when you need to access Spring-managed beans within components or instances that are not managed by the Spring framework. Below are some common approaches to achieve this: 1. Using the ApplicationContext Directly You can access Spring’s ApplicationContext (which holds the Spring container) […]
SPRING BOOT / NOTES</>↗Spring Boot12 Jul 2025
When starting your first Spring Boot application, you might encounter some common errors. Here’s a guide on how to troubleshoot them effectively. 1. Port Already in Use Error Message: java.net.BindException: Address already in use: JVM_BIND Cause: Another application (or another instance of your app) is already using the default Spring Boot port (8080). Solution: Run […]
SPRING CORE / NOTES</>↗Spring Core11 Jul 2025
In Spring, you can programmatically register beans into the application context at runtime using the BeanDefinitionRegistry or ConfigurableApplicationContext. Below are different approaches depending on your use case: 1. Using BeanDefinitionRegistry The BeanDefinitionRegistry interface can be used to dynamically register bean definitions in the Spring context. ApplicationContext implementations like AnnotationConfigApplicationContext or GenericApplicationContext expose a Bean...
SPRING BOOT / NOTES</>↗Spring Boot10 Jul 2025
Below is a step-by-step guide to create a simple CRUD API using Spring Boot and an in-memory database like H2. We will use Maven to manage the project’s dependencies. 1. Set Up Your Maven Project Create a new Maven project or directory for the Spring Boot application. pom.xml Here is the file with the necessary […]