Java/Spring
Java and JVM fundamentals, Spring, testing, data access, and backend design.
Articles
11 totalSpring Data JPA no-result lookup: Where Optional.empty becomes HTTP 404
Follow a findByRegion query returning Optional.empty, then see where a service chooses a 404 for a required single-resource API.
Java/Spring3 min
Why @Transactional tests leave data after an HTTP request in Spring Boot
A RANDOM_PORT test and its HTTP server use separate transactions. Compare a repository call that rolls back with a server write that may commit.
Java/Spring3 min
Spring @RequestParam defaultValue: Why missing limit becomes 10 but abc returns 400
Follow one Spring MVC limit parameter through missing and empty values, integer conversion failure, and a separate range check.
Java/Spring3 min
Why @Autowired is null in a new object: Spring beans vs manual construction
Compare a Spring-managed bean with an object built using new, and see how constructor injection exposes a missing dependency earlier.
Java/Spring3 min
JUnit tests pass alone but fail together: A static repository and @AfterEach
See why two tests share a static in-memory Map despite new repository objects, when @AfterEach cleanup helps, and when independent storage is safer.
Java/Spring2 min
Spring JdbcTemplate vs. JPA: Choose the Right Data Access Boundary
Compare explicit SQL and row mapping with entity-oriented access, then check transaction behavior and generated queries.
Java/Spring3 min
Spring component scanning vs Java @Bean configuration: Where should a bean be registered?
Compare stereotype annotations found by component scanning with explicit @Bean assembly and avoid registering the same service twice.
Java/Spring3 min
Spring @ResponseBody: How a String and an object become HTTP responses
See why @ResponseBody writes a response instead of a view name, and compare text and JSON conversion by inspecting the body and Content-Type.
Java/Spring3 min
Spring Model and Thymeleaf: Pass controller data into HTML safely
Follow a value from a Spring MVC controller through Model into a Thymeleaf template, then test the view, attribute, and rendered text.
Java/Spring3 min

