Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

@Retention(CLASS) @Target({TYPE, METHOD})

public @interface Scope

How many instances of a bean there are, and how long each lives.

  • singleton (the default) – one, for the life of the server.
  • prototype – a new one for every injection point.
  • request – one per HTTP request, built when the request first uses it.
  • session – one per HttpSession.

A request or session bean injected into a singleton is reached through a small class the build generates, which finds the current request’s instance on each call. That class extends the bean’s, so a request or session bean cannot be final, needs a constructor taking no arguments, and has that constructor run once at start-up for the stand-in – per-request set-up belongs in @PostConstruct, which runs on each real instance.

Methods

public abstract String value()One of singleton, prototype, request or session.

Method details

value

public abstract String value()
One of singleton, prototype, request or session.