Category: Spring MVC

Spring Web applications and services need to process client requests sent over HTTP. When the HTTP clients send data with the request, the data is in the request body. On the application side, you need a mechanism to deserialize data sent in the request body to domain objects. This is done using the @RequestBody annotation. […]Continue reading

Data validation is a basic requirement for any application. This is more significant for web applications that accept data as input. Bean Validation or commonly known as JSR-380 is a Java standard that is used to perform validation in Java applications. To perform validation, data Items are applied constraints. As long as the data satisfies […]Continue reading

When you develop a Spring Bool RESTful service, you as a programmer are responsible for handling exceptions in the service. For instance, by properly handling exceptions, you can stop the disruption of the normal flow of the application. In addition, proper exception handling ensures that the code doesn’t break when an exception occurs. Another important […]Continue reading

Should I Use Spring REST Docs or OpenAPI? Recently, I was asked which is better to use. Spring REST Docs or OpenAPI. From the perspective of generating documentation for your APIs, you may think these two options are effectively the same thing. But, it’s not exactly an apples to apples comparison. These are significantly different […]Continue reading

When developing Spring Boot applications, you need to tell the Spring Framework where to look for Spring components. Using component scan is one method of asking Spring to detect Spring managed components. Spring needs the information to locate and register all the Spring components with the application context when the application starts. Spring can auto […]Continue reading

@RequestMapping is one of the most common annotation used in Spring Web applications. This annotation maps HTTP requests to handler methods of MVC and REST controllers. In this post, you’ll see how versatile the @RequestMapping annotation is when used to map Spring MVC controller methods. Request Mapping Basics In Spring MVC applications, the RequestDispatcher (Front Controller […]Continue reading

I have met many developers who refer to tests as “Unit Tests” when they are actually integration tests. In service layers, I’ve seen tests referred to as unit tests, but written with dependencies on the actual service, such as a database, web service, or some message server. Those are part of integration testing. Even if […]Continue reading