Annotation Interface WebRoutes


@Documented @Retention(CLASS) @Target(TYPE) public @interface WebRoutes

The WebRoutes annotation is used in conjunction with the @Bean annotation to indicate a web routes configurer bean.

Web router configurer beans must implements WebRoutesConfigurer or WebRouterConfigurer, they are used to programmatically specifies web routes and/or WebSocket routes in a module. They are injected in a generated WebServerControllerConfigurer bean that can be used to configure a web server.

The routes configured in the bean can be declared in the annotation, these information are then used at compile time to detect conflicts and generate documentation.


 @WebRoutes(
     value = {
         @WebRoute(path = { "/book" })
         @WebRoute(path = { "/book/{id}" })
     },
     webSockets = {
         @WebSocketRoute(path = { "/ws" })
     }
 )
 @Bean
 public class CustomWebRouterConfigurer implements WebRouterConfigurer<WebExchange<EchangeContext>> {
     ...
 }
 
Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Returns the web routes configured in the web router configurer.
    Returns the WebSocket routes configured in the web router configurer.
  • Element Details

    • value

      WebRoute[] value

      Returns the web routes configured in the web router configurer.

      Using these information, the compiler will be able to report route definition clash: different route defined using the same parameters that are likely to conflict at runtime. It also uses them to generate documentation (OpenAPI specification).

      If you want to define undocumented routes and you know a route will not conflict with another one, you can omit to declare them.

      Returns:
      an array of web route
      Default:
      {}
    • webSockets

      WebSocketRoute[] webSockets

      Returns the WebSocket routes configured in the web router configurer.

      Using these information, the compiler will be able to report route definition clash: different route defined using the same parameters that are likely to conflict at runtime. It also uses them to generate documentation (OpenAPI specification).

      If you want to define undocumented routes and you know a route will not conflict with another one, you can omit to declare them.

      Returns:
      an array of WebSocket route
      Default:
      {}