Engineering With Java

Engineering With Java

Spring Boot Quiz - Is a @RestController singleton by default?

Suraj Mishra's avatar
Suraj Mishra
Aug 24, 2025
∙ Paid

Question

A. Yes, one per request

B. Yes, it’s a singleton

C. No, it’s prototype scoped

D. Depends on the HTTP method

Share

Answer

B. Yes, it's a singleton

Spring Controller Lifecycle

Spring controllers annotated with @RestController (or @Controller) are singleton beans by default. This means:

  • One instance of the controller is created per application context

  • All requests

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Suraj Mishra · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture