Package com.codename1.backend.annotations
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.
-
ClassDescriptionRuns this method on another thread; the caller returns at once.Binds a handler parameter to the principal of whoever the request is from: the
UserDetailsthe user store returned at sign-in, usually.Asks the build to inject this constructor, field or setter.A method of aConfigurationclass whose return value is a bean.Answers a call from the cache when the cache holds an answer for its key, and otherwise runs the method and keeps what it returned -- Spring's@Cacheable.Removes an entry from the cache when the method returns -- Spring's@CacheEvict.Always runs the method, then keeps what it returned under its key, so a laterCacheablecall of the same key is answered with it -- Spring's@CachePut.Marks a class the build constructs and injects, once per server.Constructs this bean only when a boolean expression over the configuration is true.Constructs this bean only when no other bean has its type.Constructs this bean only when a configuration key has a value.A class whoseBeanmethods produce beans.Binds a group of configuration keys to the setters of a bean.Build-time MVC declaration.A bean whoseExceptionHandlermethods apply to every controller.Counts the calls of this method, and separately the calls that threw.A cross-origin policy for one controller or one handler, as Spring's@CrossOriginis.Maps an HTTP DELETE to this method.Lets nobody call this method -- or any public method of this class.Accepted for Spring's sake and changes nothing: the build applies everyCacheable,CachePutandCacheEvictit finds, so caching needs no switch.Marks a bean method that runs when start-up is over, after everyCommandLineRunnerandApplicationRunner.Marks a method that answers for an exception a controller method threw.Marks a class the backend processors wrote, so a later pass knows its own work.Maps an HTTP GET to this method.Isolation requested for one physical transaction.Spring's@JmsListener, so a Spring listener ports by changing its import: the same asMessageListener, over whichever transport is configured.Spring Kafka's@KafkaListener, so a Spring listener ports by changing its import: the same asMessageListener, over whichever transport is configured.Constructs this bean the first time something calls it, instead of at start-up.A getter of aManagedResourcebean published as a gauge.A method of aManagedResourcebean that the management endpoint and the development MCP server can invoke.Publishes this bean'sManagedAttributegetters as metrics and itsManagedOperationmethods as operations -- the JMX model, over OpenTelemetry.Names and describes one parameter of anMcpToolmethod.Publishes this method of a bean as a tool on the server's MCP endpoint, so an agent can call it.Receives the messages of a destination: the method runs once per message, on a consumer thread of the server, and the message is acknowledged when it returns.Build-time MVC declaration.Traces this server with OpenTelemetry.Where a bean stands among the beans of its type: the lower the value, the earlier it comes in aListan injection point receives, and the earlier aSecurityFilterChainis asked whether a request is its own.Names a parameter for aPreAuthorizeexpression, which refers to it as#name.Maps an HTTP PATCH to this method.Binds a{name}segment of the path to this parameter.Lets anyone call this method -- or every public method of this class.Called once the bean is constructed and every member is injected.Maps an HTTP POST to this method.Lets this method -- or every public method of this class -- run only when an expression about the caller holds.Called when the server stops, after it has finished the requests in flight and before the database closes.The bean an injection point receives when several have its type and it names none.Constructs this bean only when a profile is active.What aTransactionalmethod does about a transaction that is already open on the calling thread.Maps an HTTP PUT to this method.Picks one bean by name where several have the type an injection point asks for.Spring AMQP's@RabbitListener, so a Spring listener ports by changing its import: the same asMessageListener, over whichever transport is configured.Binds the decoded request body to this parameter.Binds a request header to this parameter.A path, and optionally a verb, for a controller or one of its methods.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 amultipart/form-datapart that is not a file.Binds one part of amultipart/form-datarequest body to this parameter.Build-time MVC declaration.The status this method answers with when it returns normally.Marks a class whose methods answer HTTP requests.The same asControllerAdvice; the name Spring applications use for advice whose handlers answer with data rather than views.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 authorityROLE_ADMIN.Runs this method of a bean on a schedule.How many instances of a bean there are, and how long each lives.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").Records how long each call of this method takes, as a histogram.Runs this method -- or every public method of this class -- in a database transaction.Injects a configuration value.Gives every connection's virtual thread at least this much C stack.Marks acom.codename1.backend.WebSocketas the endpoint for a path.