Skip to content

Route Annotations

@Route is repeatable (via @Routes). It registers a class as a reachable route within a @UI application. A class can handle multiple paths by stacking several @Route annotations.

@Repeatable(Routes.class)
@Retention(RetentionPolicy.RUNTIME)
public @interface Route {
String value(); // route path
String[] uis() default {}; // which @UI classes expose this route
String parentRoute() default RouteConstants.NO_PARENT_ROUTE;
}
AttributeTypeDefaultDescription
valueStringURL path for this route, e.g. "/orders/list"
uisString[]{}Limits which @UI endpoints expose this route. Empty means all.
parentRouteString"_empty" (no parent)Parent route path for nested navigation
@Route("/orders/list")
public class OrderList { ... }

Use uis when multiple @UI entries exist and this route should only appear under one of them:

@Route(value = "/orders/list", uis = {"/orders"})
public class OrderList { ... }

Setting parentRoute makes this route a child of another, enabling breadcrumb navigation and nested layouts:

@Route(value = "/orders/{id}", parentRoute = "/orders/list")
public class OrderDetail { ... }
@Route("/invoices")
@Route("/bills")
public class InvoicePage { ... }

Container annotation generated automatically when multiple @Route annotations are placed on the same class. You rarely need to use it directly.

@Retention(RetentionPolicy.RUNTIME)
public @interface Routes {
Route[] value();
}

Sets a base path prefix for a configuration class. All routes relative to that class are resolved under this prefix.

@Retention(RetentionPolicy.RUNTIME)
public @interface BaseRoute {
String value(); // base path prefix
}
@BaseRoute("/admin")
public class AdminRouteConfig { ... }

Declares the default route that users land on when accessing the root of the UI. The frontend redirects to this path automatically on first load.

@Retention(RetentionPolicy.RUNTIME)
public @interface HomeRoute {
String value(); // path that serves as the home/default route
}
@UI("/orders")
@HomeRoute("/orders/list")
public class OrdersApp { ... }

The following shows a typical order management module with a shell, a list, and a detail page:

// Application shell — mounts the /orders UI and sets the default page
@UI("/orders")
@HomeRoute("/orders/list")
public class OrdersShell { ... }
// List page — registered under the /orders UI
@Route(value = "/orders/list", uis = {"/orders"})
public class OrderList { ... }
// Detail page — child of the list route; triggers breadcrumb navigation
@Route(value = "/orders/{id}", parentRoute = "/orders/list")
public class OrderDetail { ... }

When the user opens /orders, the framework redirects them to /orders/list. Navigating to /orders/123 shows the detail page with a back link to the list.