spring-guides / getting-started-guides

Getting Started Guide template :: The template for new guides and also the place to request them.
https://github.com/spring-guides/getting-started-guides/wiki
Apache License 2.0
521 stars 204 forks source link

Default value for "required" param in @RequestMapping annotation #33

Closed david-arteaga closed 7 years ago

david-arteaga commented 7 years ago

The guide at https://spring.io/guides/gs/rest-service/ and the docs (http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/bind/annotation/RequestParam.html#required--) say that the "required" param in the org.springframework.web.bind.annotation.RequestMapping annotation has a default value of false. In spite of that, when I run a project without specifying a value it defaults to true. In netbeans, when I checked the downloaded sources from Maven, the default is set to true.

There seems to be a contradiction there.

image

dsyer commented 7 years ago

The javadoc says "true" is the default for the required attribute of @RequestParam. But I'm not sure I know what you mean because you said "RequestMapping" and then linked to "RequestParam". The guide text is wrong, though, so we should fix that.

david-arteaga commented 7 years ago

I meant RequestParam, sorry about that, and I read the javadoc wrong, . But the guide text as you say is incorrect.

dsyer commented 7 years ago

Fixed in spring-guides/gs-rest-service@c29a1de. Please raise issues with individual guides if you find any more.