SPRING BOOT / CATATAN</>↗Spring Boot07 Jul 2026
Spring profiles allow you to run the same application with different configurations depending on the environment, such as development, testing, staging, or production. For example, your development environment may use an in-memory database, while production uses MySQL or PostgreSQL. 1. What Is a Spring Profile? A profile is a named set of configuration settings that […]
SPRING MVC / CATATAN</>↗Spring MVC06 Jul 2026
Building REST APIs with Spring MVC In Spring MVC, you build REST APIs by defining controller classes that map HTTP requests to Java methods. In modern Spring Boot applications, this is usually done with @RestController. A typical REST API is organized like this: HTTP Request ↓ Controller ↓ Service ↓ Repository ↓ Database Each layer […]
SPRING CORE / CATATAN</>↗Spring Core06 Jul 2026
In a Spring application, some logic does not belong to just one business feature. For example: Logging method calls Measuring execution time Checking security rules Managing transactions Auditing user actions Handling repeated exception logic These are called cross-cutting concerns because they “cut across” many parts of your application. Instead of copying the same logging, auditing, […]
SPRING CORE / CATATAN</>↗Spring Core06 Jul 2026
In Spring, events let one part of your application publish something that happened, while other parts react to it without being tightly coupled. Typical use cases: Send an email after user registration Clear a cache after data changes Audit an action Trigger async background processing React to transaction completion Spring has built-in support through: ApplicationEventPublisher […]
SPRING CORE / CATATAN</>↗Spring Core06 Jul 2026
Writing Unit Tests for Spring Components For Spring components, you usually want to test business logic without starting the full Spring application context. That means using JUnit 5 and Mockito for most unit tests. Use Spring’s test support only when you need Spring-specific behavior such as dependency injection, MVC request handling, configuration binding, or persistence […]
SPRING SECURITY / CATATAN</>↗Spring Security06 Jul 2026
Securing a Java web application typically means adding: Authentication — verifying who the user is. Authorization — deciding what the authenticated user can access. Session/token protection — keeping the login state secure. Transport and application hardening — HTTPS, CSRF protection, password hashing, etc. Since your stack includes Spring MVC / Spring Data JPA / Jakarta […]