I have a Spring Boot project with a model class below:
import javax.validation.constraints.*;
import lombok.Data;
@Data
public class Item {
@NotNull
public int id;
@NotNull
@Email
public String email;
}
Here is my API's action:
@PostMapping
public ResponseEntity<Item> createItem(@Valid @RequestBody Item item) {
try {
Item createdItem = new Item();
URI createdUri = URI.create("/api/Home/999");
return ResponseEntity.created(createdUri).body(createdItem);
} catch (Exception e) {
return ResponseEntity.internalServerError().build();
}
}
I'm trying to use the Hot Code Replace feature with input validation in Spring Boot. Here is what I found. When I changed the validation annotation in the model class, the Hot Code Replace is not working. I have to restart my app to take effect. Is there any way to support this?