Issue
From Spring Framework Reference 5.2.7.RELEASE
:
For a
@RequestMapping
without HTTP method declarations, theAllow
header is set toGET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS
.
Which certainly meets our day-to-day coding experiences.
But, in Spring Framework API Documentation [5.2.7.RELEASE
] of RequestMapping
:
The default value for the element method
is presented as
Default:
{}
I am confused by this. What am I missing here?
Solution
The method
argument can be used to limit the accepted HTTP methods. The default is that there is no limit. So by default it allows all HTTP methods.
Now this is exactly what the reference guide is telling you.
For a
@RequestMapping
without HTTP method declarations, theAllow
header is set toGET
,HEAD
,POST
,PUT
,PATCH
,DELETE
,OPTIONS
.
There is no method
declaration to limit it, hence everything is accepted.
Answered By - M. Deinum