Differences from Spring

spring_boot_starter_web follows Spring Boot and Spring MVC: the same annotations, the same property names where they make sense, the same answers. This page lists every place where it does not, and why, grouped by topic. The last section lists what is not there yet.

Why

When you port a Spring application, or follow a Spring tutorial, you need to know where the behaviour is not the one you expect. Most differences come from three facts:

Example

The same controller in both. The code is nearly the same; the differences are in the details below.

@RestController()
@RequestMapping('/api/books')
class BookController {
  BookController(this.books);
  final BookService books;

  @GetMapping('/{isbn}')
  Future<Book> find(@PathVariable() String isbn) => books.find(isbn);

  @GetMapping()
  Future<List<Book>> search(@RequestParam('q') String? query) => books.search(query);
}
@RestController
@RequestMapping("/api/books")
class BookController {
  @GetMapping("/{isbn}")
  Book find(@PathVariable String isbn) { ... }

  @GetMapping
  List<Book> search(@RequestParam(name = "q", required = false) String query) { ... }
}

Required or optional comes from the Dart parameter (String?, a default value), not from required and defaultValue. See @RequestParam.

Configuration

See All properties.

The server

Behind a proxy

See Behind a reverse proxy.

Controllers and parameters

Errors

Streams, uploads and downloads

Static resources

Stricter and a little richer than Spring's ResourceHttpRequestHandler. See Static resources.

Sessions

See Sessions.

CORS

See CORS.

WebSocket

See WebSocket.

Testing

See Testing.

Not yet

These are planned but not there yet:

In Spring (Java)

This whole page compares with Spring. In short, code moves over with small changes:

See also