Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-14988

@GetMapping method annotation uses consumes attribute from @RequestMapping class annotation

    XMLWordPrintable

    Details

      Description

      @GetMapping method-level annotation on method uses consumes element from @RequestMapping annotation on class and doesn't allow to override it.

      As a result if you specify consumes element in class level annotation your GET mapping handler becomes unusable since it requires an appropriate`Content-Type` request header.

      	@Controller
      	@RequestMapping(consumes = MediaType.APPLICATION_XML_VALUE)
      	public class ComposedAnnotationController {
      
      		@GetMapping("/get")
      		public void get() {
      			// Cannot be called without Content-Type header
      		}
      
      	}
      

        Attachments

          Activity

            People

            Assignee:
            rstoya05-aop Rossen Stoyanchev
            Reporter:
            bedrin Dmitry Bedrin
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              3 years, 31 weeks ago

                Time Tracking

                Estimated:
                Original Estimate - 0.25d
                0.25d
                Remaining:
                0d
                Logged:
                Time Not Required
                Not Specified