SPRING MVC / CATATAN</>↗Spring MVC23 Jul 2025
To configure Spring MVC using a Java-based configuration, you can follow these steps: Enable Spring MVC support by using the @EnableWebMvc annotation. Create a Spring configuration class annotated with @Configuration. Configure the component scanning to detect controllers, services, and other components. Define a ViewResolver bean to map view names to actual views (e.g., JSPs, Thymeleaf […]
SPRING BOOT / CATATAN</>↗Spring Boot22 Jul 2025
To implement global exception handling in a Spring application, the @ControllerAdvice annotation is used. It allows you to centralize exception handling across multiple controllers. Below is an example of how you can implement global exception handling with @ControllerAdvice in your application: 1. Define a Global Exception Handler Create a class with the @ControllerAdvice annotation to […]
SPRING MVC / CATATAN</>↗Spring MVC21 Jul 2025
Creating a simple “Hello World” web application using Spring MVC involves several steps. Below is a guide that will walk you through creating the application from scratch: 1. Set Up the Project Use a build tool like Maven or Gradle to manage your dependencies. Here, we’ll use Maven. pom.xml Create a pom.xml file and include […]
SPRING BOOT / CATATAN</>↗Spring Boot20 Jul 2025
Lombok is an excellent library for reducing boilerplate code in Java applications, including Spring Boot projects. It provides useful annotations that simplify mundane tasks like generating getters, setters, constructors, hashCode, equals, and toString methods. Here’s how to use Lombok in a Spring Boot project to make your code cleaner and more concise: Steps to Use […]
SPRING CORE / CATATAN</>↗Spring Core19 Jul 2025
In Spring, Dependency Injection (DI) and Aspect-Oriented Programming (AOP) can work seamlessly together, allowing you to address cross-cutting concerns (e.g., logging, transaction management, security) while still benefiting from Spring’s dependency management. Here’s how you can use Dependency Injection with AOP in Spring: 1. Enable Aspect-Oriented Programming in Spring To enable the AOP functionality in your […]
SPRING BOOT / CATATAN</>↗Spring Boot18 Jul 2025
In Spring Boot (and the larger Spring Framework), the annotations @Entity, @Repository, and @Service play a key role in structuring and organizing applications using the principles of dependency injection and inversion of control. Here’s an overview of each: 1. @Entity Definition: The @Entity annotation is used in Java Persistence API (JPA) to define a class […]