protected void runJoyInitBeans() { final PetiteContainer pc = joyPetite.getPetiteContainer(); pc.forEachBeanType(JoyInit.class, beanName -> { final JoyInit joyInit = pc.getBean(beanName); if (joyInit != null) { joyInit.onJoy(); } }); }
@Override public JoyPetite disableAutoConfiguration() { requireNotStarted(petiteContainer); autoConfiguration = false; return this; }
/** * Returns PetiteContainer once when it is created. */ public PetiteContainer getPetiteContainer() { return requireStarted(petiteContainer); }
joyScanner.start(); joyPetite.start(); joyPetite.getPetiteContainer().addBean(appName + ".core", this); joyPetite.getPetiteContainer().addBean(appName + ".scanner", joyScanner); joyPetite.printBeans(100); joyDb.printEntities(100); joyMadvoc.printRoutes(100); joyProps.getProps(), joyProxetta.getProxetta(), joyPetite.getPetiteContainer(), joyMadvoc.getWebApp(), joyDb.isDatabaseEnabled(), joyProps.getProps(), joyProxetta.getProxetta(), joyPetite.getPetiteContainer(), joyMadvoc.getWebApp() );
/** * Creates and initializes Petite container. * It will be auto-magically configured by scanning the classpath. */ @Override public void start() { initLogger(); log.info("PETITE start ----------"); petiteContainer = createPetiteContainer(); if (externalsCache) { petiteContainer.setExternalsCache(TypeCache.createDefault()); } log.info("Web application? " + isWebApplication); if (!isWebApplication) { // make session scope to act as singleton scope // if this is not a web application (and http session is not available). petiteContainer.registerScope(SessionScope.class, new SingletonScope(petiteContainer)); } // load parameters from properties files petiteContainer.defineParameters(joyPropsSupplier.get().getProps()); // automagic configuration if (autoConfiguration) { final AutomagicPetiteConfigurator automagicPetiteConfigurator = new AutomagicPetiteConfigurator(petiteContainer); automagicPetiteConfigurator.registerAsConsumer(joyScannerSupplier.get().getClassScanner()); } petiteContainerConsumers.accept(this.petiteContainer); log.info("PETITE OK!"); }
/** * Stops the Joy. */ public void stop() { joyProps.stop(); try { joyDb.stop(); joyPetite.stop(); } catch (Exception ignore) { } if (log != null) { log.info("Joy is down. Bye, bye!"); } }
public JoddJoy() { appName = "joy"; joyPaths = new JoyPaths(); joyPaths.start(); joyScanner = new JoyScanner(); joyProps = new JoyProps(() -> appName); joyProxetta = new JoyProxetta(); joyPetite = new JoyPetite( () -> appName, () -> joyProxetta, () -> joyProps, () -> joyScanner ); joyDb = new JoyDb( () -> appName, () -> joyPetite, () -> joyProxetta, () -> joyScanner); joyMadvoc = new JoyMadvoc( () -> appName, () -> joyPetite, () -> joyProxetta, () -> joyProps, () -> joyScanner ); }
}) .forEach(beanDefinition -> { print.out(Chalk256.chalk().yellow(), scopeName(beanDefinition), 10); print.space();
joyScanner.start(); joyPetite.start(); joyPetite.getPetiteContainer().addBean(appName + ".core", this); joyPetite.getPetiteContainer().addBean(appName + ".scanner", joyScanner); joyPetite.printBeans(100); joyDb.printEntities(100); joyMadvoc.printRoutes(100); joyProps.getProps(), joyProxetta.getProxetta(), joyPetite.getPetiteContainer(), joyMadvoc.getWebApp(), joyDb.isDatabaseEnabled(), joyProps.getProps(), joyProxetta.getProxetta(), joyPetite.getPetiteContainer(), joyMadvoc.getWebApp() );
/** * Creates and initializes Petite container. * It will be auto-magically configured by scanning the classpath. */ @Override public void start() { initLogger(); log.info("PETITE start ----------"); petiteContainer = createPetiteContainer(); if (externalsCache) { petiteContainer.setExternalsCache(TypeCache.createDefault()); } log.info("Web application? " + isWebApplication); if (!isWebApplication) { // make session scope to act as singleton scope // if this is not a web application (and http session is not available). petiteContainer.registerScope(SessionScope.class, new SingletonScope(petiteContainer)); } // load parameters from properties files petiteContainer.defineParameters(joyPropsSupplier.get().getProps()); // automagic configuration if (autoConfiguration) { final AutomagicPetiteConfigurator automagicPetiteConfigurator = new AutomagicPetiteConfigurator(petiteContainer); automagicPetiteConfigurator.registerAsConsumer(joyScannerSupplier.get().getClassScanner()); } petiteContainerConsumers.accept(this.petiteContainer); log.info("PETITE OK!"); }
/** * Stops the Joy. */ public void stop() { joyProps.stop(); try { joyDb.stop(); joyPetite.stop(); } catch (Exception ignore) { } if (log != null) { log.info("Joy is down. Bye, bye!"); } }
public JoddJoy() { appName = "joy"; joyPaths = new JoyPaths(); joyPaths.start(); joyScanner = new JoyScanner(); joyProps = new JoyProps(() -> appName); joyProxetta = new JoyProxetta(); joyPetite = new JoyPetite( () -> appName, () -> joyProxetta, () -> joyProps, () -> joyScanner ); joyDb = new JoyDb( () -> appName, () -> joyPetite, () -> joyProxetta, () -> joyScanner); joyMadvoc = new JoyMadvoc( () -> appName, () -> joyPetite, () -> joyProxetta, () -> joyProps, () -> joyScanner ); }
}) .forEach(beanDefinition -> { print.out(Chalk256.chalk().yellow(), scopeName(beanDefinition), 10); print.space();
@Override public JoyPetite disableExternalsCache() { requireNotStarted(petiteContainer); externalsCache = true; return this; }
webApp = webAppSupplier == null ? new PetiteWebApp(joyPetiteSupplier.get().getPetiteContainer()) : webAppSupplier.get();
/** * Returns PetiteContainer once when it is created. */ public PetiteContainer getPetiteContainer() { return requireStarted(petiteContainer); }
@Override public JoyPetite withPetite(final Consumer<PetiteContainer> petiteContainerConsumer) { requireNotStarted(petiteContainer); petiteContainerConsumers.add(petiteContainerConsumer); return this; }
final PetiteContainer petiteContainer = joyPetiteSupplier.get().getPetiteContainer();
@Override public JoyPetite disableAutoConfiguration() { requireNotStarted(petiteContainer); autoConfiguration = false; return this; }
protected void runJoyInitBeans() { final PetiteContainer pc = joyPetite.getPetiteContainer(); pc.forEachBeanType(JoyInit.class, beanName -> { final JoyInit joyInit = pc.getBean(beanName); if (joyInit != null) { joyInit.onJoy(); } }); }