public synchronized static JoddJoy get() { if (joddJoy == null) { joddJoy = new JoddJoy(); } return joddJoy; }
/** * Creates {@link JoddJoy}. This is a place where to configure the app. */ protected JoddJoy createJoy() { final JoddJoy joy = JoddJoy.get(); if (SystemUtil.info().isAtLeastJavaVersion(9)) { joy.withScanner(joyScanner -> joyScanner.scanClasspathOf(this.getClass())); } return joy; }
/** * Starts the Joy without the web application. */ public JoddJoyRuntime startOnlyBackend() { return start(null); }
/** * Runs JOY in standalone mode, with only backend. */ public void runJoy(final Consumer<JoddJoyRuntime> consumer) { final JoddJoy joddJoy = new JoddJoy(); final JoddJoyRuntime joyRuntime = joddJoy.startOnlyBackend(); joddJoy.withDb(joyDb -> setJtxManager(joyRuntime.getJtxManager())); final JtxTransaction tx = startRwTx(); final Print print = new Print(); try { print.line("START", 80); print.newLine(); consumer.accept(joyRuntime); print.newLine(); print.line("END", 80); if (tx != null) { tx.commit(); } } catch (Throwable throwable) { throwable.printStackTrace(); if (tx != null) { tx.rollback(); } } joddJoy.stop(); }
log = LoggerFactory.getLogger(JoddJoy.class); printLogo(); joyMadvoc.start(); runJoyInitBeans(); ex.printStackTrace(); stop(); throw ex;
/** * Runs JOY in standalone mode, with only backend. */ public void runJoy(final Consumer<JoddJoyRuntime> consumer) { final JoddJoy joddJoy = new JoddJoy(); final JoddJoyRuntime joyRuntime = joddJoy.startOnlyBackend(); joddJoy.withDb(joyDb -> setJtxManager(joyRuntime.getJtxManager())); final JtxTransaction tx = startRwTx(); final Print print = new Print(); try { print.line("START", 80); print.newLine(); consumer.accept(joyRuntime); print.newLine(); print.line("END", 80); if (tx != null) { tx.commit(); } } catch (Throwable throwable) { throwable.printStackTrace(); if (tx != null) { tx.rollback(); } } joddJoy.stop(); }
log = LoggerFactory.getLogger(JoddJoy.class); printLogo(); joyMadvoc.start(); runJoyInitBeans(); ex.printStackTrace(); stop(); throw ex;
/** * Creates {@link JoddJoy}. This is a place where to configure the app. */ protected JoddJoy createJoy() { final JoddJoy joy = JoddJoy.get(); if (SystemUtil.info().isAtLeastJavaVersion(9)) { joy.withScanner(joyScanner -> joyScanner.scanClasspathOf(this.getClass())); } return joy; }
@Override public void contextInitialized(final ServletContextEvent sce) { final ServletContext servletContext = sce.getServletContext(); createJoyAndInitServletContext(servletContext).start(servletContext); }
public synchronized static JoddJoy get() { if (joddJoy == null) { joddJoy = new JoddJoy(); } return joddJoy; }
/** * Starts the Joy without the web application. */ public JoddJoyRuntime startOnlyBackend() { return start(null); }
@Override public void contextInitialized(final ServletContextEvent sce) { final ServletContext servletContext = sce.getServletContext(); createJoyAndInitServletContext(servletContext).start(servletContext); }