/** * Configures {@link jodd.petite.PetiteContainer} with specified class path. */ public void configure() { long elapsed = System.currentTimeMillis(); final ClassScanner classScanner = new ClassScanner(); classScanner.detectEntriesMode(true); classScanner.scanDefaultClasspath(); classScannerConsumers.accept(classScanner); registerAsConsumer(classScanner); try { classScanner.start(); } catch (Exception ex) { throw new PetiteException("Scan classpath error", ex); } elapsed = System.currentTimeMillis() - elapsed; log.info("Petite configured in " + elapsed + " ms. Total beans: " + container.beansCount()); }
/** * 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!"); }
/** * Configures {@link jodd.petite.PetiteContainer} with specified class path. */ public void configure() { long elapsed = System.currentTimeMillis(); final ClassScanner classScanner = new ClassScanner(); classScanner.detectEntriesMode(true); classScanner.scanDefaultClasspath(); classScannerConsumers.accept(classScanner); registerAsConsumer(classScanner); try { classScanner.start(); } catch (Exception ex) { throw new PetiteException("Scan classpath error", ex); } elapsed = System.currentTimeMillis() - elapsed; log.info("Petite configured in " + elapsed + " ms. Total beans: " + container.beansCount()); }
/** * 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!"); }