Tech
Validation on Spring
Invalid inputs are the root of all evil! Or would you run your coffee maker on rocks?
How to start ?
We need the dependency:
<dependency>
<groupId> org.springframework.boot </groupId>
<artifactId> spring-boot-starter-validation </artifactId>
</dependency>
When do we validate?
As a rule of thumb for REST APIs: As soon as a controller method accepts a @RequestBody , it must be preceded by a @Valid !
...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to