Bird
0
0

Which annotation attribute in Spring Boot controller methods specifies the response content types for content negotiation?

easy📝 Syntax Q3 of 15
Spring Boot - Request and Response Handling
Which annotation attribute in Spring Boot controller methods specifies the response content types for content negotiation?
Avalue
Bconsumes
Cheaders
Dproduces
Step-by-Step Solution
Solution:
  1. Step 1: Understand annotation attributes

    The 'produces' attribute defines which content types the method can return.
  2. Step 2: Differentiate from 'consumes'

    'consumes' defines accepted request content types, not response types.
  3. Final Answer:

    produces -> Option D
  4. Quick Check:

    Response content type attribute = produces [OK]
Quick Trick: 'produces' sets response formats, 'consumes' sets request formats [OK]
Common Mistakes:
  • Mixing up 'produces' and 'consumes'
  • Using 'value' to specify content types
  • Assuming 'headers' controls content type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes