Route Annotations
Migrating
Section titled “Migrating”| Removed annotation | Current equivalent |
|---|---|
@Route("/orders/list") on a class | a 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 / after
Section titled “Before / after”// 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 { ... }type: RoutesbasePath: /ordersroutes: - route: list viewModel: com.acme.OrderListRoutes 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.
Several URLs over one class
Section titled “Several URLs over one class”routes: - route: invoices viewModel: com.acme.InvoicePage - route: bills viewModel: com.acme.InvoicePageNested routes
Section titled “Nested routes”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.OrderDetailAt 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.