SPRING CORE / CATATAN</>↗Spring Core17 Jul 2025
Building dynamic dependency injection in a Spring-based application can be achieved using a combination of ApplicationContextAware and BeanDefinitionRegistryPostProcessor. This approach allows you to dynamically register and manage beans at runtime. Below is a step-by-step breakdown of how you can achieve this: 1. Using ApplicationContextAware ApplicationContextAware can be used to access the ApplicationContext. The ApplicationContext provides […]
SPRING BOOT / CATATAN</>↗Spring Boot16 Jul 2025
Here’s a guide on how to connect your Spring Boot application to a MySQL or PostgreSQL database. These steps assume you are already familiar with basic Spring Boot concepts. 1. Add the Necessary Dependencies Open your (for Maven) or build.gradle (for Gradle), and add the database driver and Spring Boot starter dependencies: pom.xml Maven: <!– […]
SPRING CORE / CATATAN</>↗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 / CATATAN</>↗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 / CATATAN</>↗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 / CATATAN</>↗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 […]