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

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

public @interface Configuration

A class whose Bean methods produce beans.

The class itself is a bean too, so its own constructor and fields can be injected before its factory methods are called. The build calls each factory method exactly once, directly, from the entry point it generates – so unlike Spring there is no proxy, and one @Bean method calling another simply gets a second object. Take the other bean as a PARAMETER instead, which is what the build wires:

@Configuration
public class Clients {
    @Bean
    public Mailer mailer(@Value("${mail.host:localhost}") String host) {
        return new Mailer(host);
    }
    @Bean
    public Notifier notifier(Mailer mailer) {
        return new Notifier(mailer);
    }
}

Methods

public abstract String value() default ""The bean’s name, for Qualifier.

Method details

value

public abstract String value() default ""
The bean’s name, for Qualifier. Empty means the default name.