Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
@Retention(CLASS) @Target({CONSTRUCTOR, METHOD, FIELD})
public @interface Autowired
Asks the build to inject this constructor, field or setter.
A class with exactly one public constructor does not need the annotation on it – that constructor is used – which is Spring’s rule too. A field or a setter does: the build injects members only when asked.
A private field is fine. The build adds a setter to the compiled class for the generated entry point to call, because there is no reflection to reach it with. A final field cannot be injected at all, and is refused.
Methods
public abstract boolean required() default true | Whether a bean must exist. |
Method details
required
public abstract boolean required() default trueWhether a bean must exist. When false and there is none, the field keeps
its initial value, the setter is not called, and a constructor parameter
receives null.