Return to site

SPRING CERTIFICATION QUESTION: What is the difference between '@Controller' and '@RestController'?

· java,spring,vcp

'@RestController' is a compound annotation,

which is meta-annotated with '@Controller'and '@ResponseBody' annotations.

Thus response-request bodies are a subject of http-converters omitting view-model phase.

One might prefer to use '@Controller' and '@ResponseBody' annotations instead;

'@RestController' is just a convenience annotation.

#spring #certificationquestion #vcp




All Posts

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!