Annotation Type RestController


@Retention(CLASS) @Target(TYPE) public @interface RestController

Marks a class whose methods answer HTTP requests.

The build scans for these and generates a router, so a controller is an ordinary class with no base type, no interface, and nothing to register at start-up. Deliberately the name Spring uses: the shape is meant to be readable without learning it first.

Routing is decided at BUILD time rather than by scanning at start-up or by a map lookup per request. The generated router compares the target's bytes where the parser already holds them, so a controller costs no more than the hand-written equals chain it replaces.