Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
package com.codename1.backend.annotations
Annotations that turn an ordinary class into an HTTP or websocket endpoint.
Mark a class RestController and its methods with GetMapping,
PostMapping and the other verb mappings; bind the request to parameters with
PathVariable, RequestParam, RequestHeader and RequestBody. The build
reads these annotations and generates the router, so routing is decided at
build time rather than by reflection when the server starts. The names follow
Spring’s, so the shape reads without learning it first.
Server code: these annotations are read by the backend build and mean nothing in an app.
Types
annotation Async | Runs this method on another thread; the caller returns at once. |
annotation AuthenticationPrincipal | Binds a handler parameter to the principal of whoever the request is from: the UserDetails the user store returned at sign-in, usually. |
annotation Autowired | Asks the build to inject this constructor, field or setter. |
annotation Bean | A method of a Configuration class whose return value is a bean. |
annotation Component | Marks a class the build constructs and injects, once per server. |
annotation ConditionalOnMissingBean | Constructs this bean only when no other bean has its type. |
annotation ConditionalOnProperty | Constructs this bean only when a configuration key has a value. |
annotation Configuration | A class whose Bean methods produce beans. |
annotation ConfigurationProperties | Binds a group of configuration keys to the setters of a bean. |
annotation Counted | Counts the calls of this method, and separately the calls that threw. |
annotation DeleteMapping | Maps an HTTP DELETE to this method. |
annotation DenyAll | Lets nobody call this method – or any public method of this class. |
annotation Generated | Marks a class the backend processors wrote, so a later pass knows its own work. |
annotation GetMapping | Maps an HTTP GET to this method. |
annotation Lazy | Constructs this bean the first time something calls it, instead of at start-up. |
annotation ManagedAttribute | A getter of a ManagedResource bean published as a gauge. |
annotation ManagedOperation | A method of a ManagedResource bean that the management endpoint and the development MCP server can invoke. |
annotation ManagedResource | Publishes this bean’s ManagedAttribute getters as metrics and its ManagedOperation methods as operations – the JMX model, over OpenTelemetry. |
annotation McpParam | Names and describes one parameter of an McpTool method. |
annotation McpTool | Publishes this method of a bean as a tool on the server’s MCP endpoint, so an agent can call it. |
annotation OpenTelemetry | Traces this server with OpenTelemetry. |
annotation Order | Where a bean stands among the beans of its type: the lower the value, the earlier it comes in a List an injection point receives, and the earlier a SecurityFilterChain is asked whether a request is its own. |
annotation P | Names a parameter for a PreAuthorize expression, which refers to it as #name. |
annotation PatchMapping | Maps an HTTP PATCH to this method. |
annotation PathVariable | Binds a {name} segment of the path to this parameter. |
annotation PermitAll | Lets anyone call this method – or every public method of this class. |
annotation PostConstruct | Called once the bean is constructed and every member is injected. |
annotation PostMapping | Maps an HTTP POST to this method. |
annotation PreAuthorize | Lets this method – or every public method of this class – run only when an expression about the caller holds. |
annotation PreDestroy | Called when the server stops, after it has finished the requests in flight and before the database closes. |
annotation Primary | The bean an injection point receives when several have its type and it names none. |
annotation Profile | Constructs this bean only when a profile is active. |
enum Propagation | What a Transactional method does about a transaction that is already open on the calling thread. |
annotation PutMapping | Maps an HTTP PUT to this method. |
annotation Qualifier | Picks one bean by name where several have the type an injection point asks for. |
annotation RequestBody | Binds the decoded request body to this parameter. |
annotation RequestHeader | Binds a request header to this parameter. |
annotation RequestMapping | A path, and optionally a verb, for a controller or one of its methods. |
annotation RequestParam | Binds a request parameter to this parameter: the query string’s value, or, when the query has none, a field of the form the body carries – application/x-www-form-urlencoded, or a multipart/form-data part that is not a file. |
annotation RequestPart | Binds one part of a multipart/form-data request body to this parameter. |
annotation ResponseStatus | The status this method answers with when it returns normally. |
annotation RestController | Marks a class whose methods answer HTTP requests. |
annotation RolesAllowed | Lets this method – or every public method of this class – run only for a caller holding one of these roles: @RolesAllowed("ADMIN") asks for the authority ROLE_ADMIN. |
annotation Scheduled | Runs this method of a bean on a schedule. |
annotation Scope | How many instances of a bean there are, and how long each lives. |
annotation Secured | Lets this method – or every public method of this class – run only for a caller holding one of these authorities, each written in full: @Secured("ROLE_ADMIN"). |
enum ThreadKind | Which kind of thread runs background work: an Async method or a Scheduled job. |
annotation Timed | Records how long each call of this method takes, as a histogram. |
annotation Transactional | Runs this method – or every public method of this class – in a database transaction. |
annotation Value | Injects a configuration value. |
annotation WebSocketMapping | Marks a com.codename1.backend.WebSocket as the endpoint for a path. |