Search in sources :

Example 1 with AutomagicMadvocConfigurator

use of jodd.madvoc.AutomagicMadvocConfigurator in project jodd by oblac.

the class JoyMadvoc method start.

// ---------------------------------------------------------------- lifecycle
@Override
public void start() {
    initLogger();
    log.info("MADVOC start  ----------");
    webApp = webAppSupplier == null ? new PetiteWebApp(joyPetiteSupplier.get().getPetiteContainer()) : webAppSupplier.get();
    webApp.withRegisteredComponent(ActionConfigManager.class, acm -> {
        acm.bindAnnotationConfig(Action.class, JoyActionConfig.class);
        acm.bindAnnotationConfig(RestAction.class, JoyRestActionConfig.class);
    });
    if (servletContext != null) {
        webApp.bindServletContext(servletContext);
    }
    final Props allProps = joyPropsSupplier.get().getProps();
    webApp.withParams(allProps.innerMap(beanNamePrefix()));
    webApp.registerComponent(new ProxettaSupplier(joyProxettaSupplier.get().getProxetta()));
    webApp.registerComponent(ProxettaAwareActionsManager.class);
    // Automagic Madvoc configurator will scan and register ALL!
    // This way we reduce the startup time and have only one scanning.
    // Scanning happens in the INIT phase.
    final AutomagicMadvocConfigurator automagicMadvocConfigurator = new AutomagicMadvocConfigurator(joyScannerSupplier.get().getClassScanner()) {

        @Override
        protected String createInfoMessage() {
            return "Scanning completed in " + elapsed + "ms.";
        }
    };
    webApp.registerComponent(automagicMadvocConfigurator);
    webAppConsumers.accept(webApp);
    webApp.start();
    log.info("MADVOC OK!");
}
Also used : ProxettaSupplier(jodd.madvoc.proxetta.ProxettaSupplier) AutomagicMadvocConfigurator(jodd.madvoc.AutomagicMadvocConfigurator) Props(jodd.props.Props) PetiteWebApp(jodd.madvoc.petite.PetiteWebApp)

Aggregations

AutomagicMadvocConfigurator (jodd.madvoc.AutomagicMadvocConfigurator)1 PetiteWebApp (jodd.madvoc.petite.PetiteWebApp)1 ProxettaSupplier (jodd.madvoc.proxetta.ProxettaSupplier)1 Props (jodd.props.Props)1