Skip to content

Route Annotations

Removed annotationCurrent equivalent
@Route("/orders/list") on a classa routes.yaml entry route: orders/list + viewModel: <the class FQCN>
@Route(value = "/orders/list", uis = {"/orders"})an entry in a route file tagged basePath: /orders (or, for a CRUD sub-route of the root mount, the full relative path, e.g. users/:id/edit)
@Route(value = "/x", parentRoute = "/home")a children: entry under the home route — the child renders in its parent’s slot
@Route("/a") + @Route("/b") (@Routes)two entries with the same viewModel (optionally told apart by fixedParams)
@HomeRoute("/orders/list")the app’s first menu item, or implements HomeRouteSupplier returning "/orders/list"
// Before (no longer compiles)
@UI("/orders")
@HomeRoute("/orders/list")
public class OrdersApp { ... }
@Route("/orders/list")
public class OrderList { ... }
// After
@UI("/orders")
public class OrdersApp implements HomeRouteSupplier {
@Override public String homeRoute() { return "/orders/list"; } // optional: the first menu item is the default
}
public class OrderList { ... }
src/main/resources/specs/ui/orders-routes.yaml
type: Routes
basePath: /orders
routes:
- route: list
viewModel: com.acme.OrderList

Routes in a route file are relative to the mount (list under basePath: /orders answers /orders/list). A specs/ui/routes.yaml with no basePath serves the root mount.

routes:
- route: invoices
viewModel: com.acme.InvoicePage
- route: bills
viewModel: com.acme.InvoicePage

A route nests under another through children (each flattened child carries its parent as RouteEntry.parent):

routes:
- route: orders/list
viewModel: com.acme.OrderList
children:
- route: ":id" # → orders/list/:id
viewModel: com.acme.OrderDetail

At runtime the request resolves as a route chain: the outermost level not yet on screen renders first and draws the child in its slot, so a reload or a deep link to the child lands inside its parent. See a record master whose tabs are pages.

Tip — nest detail routes under the listing route. Declaring the detail as orders/:id (instead of a sibling like order/:id) keeps the app shell’s navigation tab highlighted while the user drills into a record: the active tab is derived from the current route by longest prefix match, so /orders/42 keeps the Orders tab selected. The home route never wins by prefix.


See the route registry for the full format.