Question:
Make spring endpoint with optional request parameters
Solution:
To make the request parameter optional on the spring controller, user JAVA 8 feature Option type or set required attribute to false.
public void count(@RequestParam(name="name") Optionalname){ if (name.isPresent()) { String name= name.get() .... } }
0 comments:
Post a Comment