Hello World:
public class App extends Jooby {
{
get("/", ctx -> "Hello World!");
}
public static void main(String[] args) {
runApp(args, App::new);
}
}
More documentation at jooby.io- Since:
- 2.0.0
- Author:
- edgar
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jooby.Router
Router.Match
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionafter
(Route.After after) Add an after route decorator to the route pipeline.<T> T
Get an attribute by his key.Set an application attribute.before
(Route.Before before) Add a before route decorator to the route pipeline.converter
(ValueConverter converter) Add a custom string value converter.static Jooby
createApp
(String[] args, ExecutionMode executionMode, Supplier<Jooby> provider) Setup default environment, logging (logback or log4j2) and run application.decoder
(MediaType contentType, MessageDecoder decoder) Register a decoder for the given content type.Dispatch route pipeline to theRouter.getWorker()
worker thread pool.Dispatch route pipeline to the given executor.Enabled routes for specific domain.Enabled routes for specific domain.encoder
(MediaType contentType, MessageEncoder encoder) Register a route response encoder.encoder
(MessageEncoder encoder) Register a route response encoder.error
(ErrorHandler handler) Add a custom error handler.errorCode
(Class<? extends Throwable> type, StatusCode statusCode) Map an exception type to a status code.Computes the status code for the given exception.Put an executor into the application registry.Mutable map of application attributes.Get base application package.Get all complex/bean value converters.Application class loader.com.typesafe.config.Config
Application configuration.Get application context path (a.k.a as base path).Get all simple/string value converters.Application environment.Get the error handler.Application execution mode.Template for the flash cookie.Returns the list of supported locales, ornull
if none set.org.slf4j.Logger
getLog()
Application logger.getName()
Get application's name.The underlying router.Router options.Returns all routes.Server options ornull
.Application service registry.Session store.Controls the level of information logged during startup.Application temporary directory.Get application version (description/debugging purpose only).Returns the worker thread pool.Install extension module.Set server to use.install
(SneakyThrows.Supplier<Jooby> factory) Installs/imports a full application into this one.install
(String path, SneakyThrows.Supplier<Jooby> factory) Installs/imports a full application into this one.Installs/imports a full application into this one.install
(Predicate<Context> predicate, SneakyThrows.Supplier<Jooby> factory) Installs/imports a full application into this one.boolean
boolean
boolean
When true handles X-Forwarded-* headers by updating the values on the current context to match what was sent in the header(s).Find a matching route using the given context.boolean
Find a matching route using the given context.Import all routes from the given router.Import all routes from the given router and prefix them with the given path.Import routes from given router.Import routes from given action.Import all route method from the given controller class.<T> Jooby
Import all route method from the given controller class.Import all route methods from given controller instance.Event is fire once all components has been initialized, for example router and web-server are up and running, extension installed, etc...Event fired before starting router and web-server.onStop
(AutoCloseable body) Stop event is fire at application shutdown time.Group one or more routes under a common path prefix.Callback method that indicates application was successfully started it and listening for connections.Set application registry.<T> T
require
(ServiceKey<T> key) Provides an instance of the given type.<T> T
Provides an instance of the given type.<T> T
Provides an instance of the given type where name matches it.resultHandler
(ResultHandler handler) Add a response handler factory.route
(String method, String pattern, Route.Handler handler) Add a route.Group one or more routes.static void
runApp
(String[] args, ExecutionMode executionMode, Consumer<Jooby> consumer) Setup default environment, logging (logback or log4j2) and run application.static void
runApp
(String[] args, ExecutionMode executionMode, Supplier<Jooby> provider) Setup default environment, logging (logback or log4j2) and run application.static void
Setup default environment, logging (logback or log4j2) and run application.static void
Setup default environment, logging (logback or log4j2) and run application.setBasePackage
(String basePackage) setBufferFactory
(DataBufferFactory bufferFactory) setContextAsService
(boolean contextAsService) If enabled, allows to retrieve theContext
object associated with the current request via the service registry while the request is being processed.setContextPath
(String basePath) Set application context path.setCurrentUser
(Function<Context, Object> provider) Provides a way to set the current user from aContext
.setDefaultWorker
(Executor worker) Set the default worker thread pool.setEnvironment
(Environment environment) Set application environment.setEnvironmentOptions
(EnvironmentOptions options) Set environment options and initialize/overrides the environment.Set application execution mode.setFlashCookie
(Cookie flashCookie) Sets a cookie used as a template to generate the flash cookie, allowing to customize the cookie name and other cookie parameters.setHiddenMethod
(String parameterName) Provides a way to override the current HTTP method.setHiddenMethod
(Function<Context, Optional<String>> provider) Provides a way to override the current HTTP method using lookup strategy.setLateInit
(boolean lateInit) Force all module to be initialized lazily at application startup time (not at creation/instantiation time).setLocales
(List<Locale> locales) Sets the supported locales.setLocales
(Locale... locales) Sets the supported locales.Set application name.setRouterOptions
(RouterOption... options) Set router options.setServerOptions
(ServerOptions serverOptions) Set server options.setSessionStore
(SessionStore store) Set session store.setStartupSummary
(List<StartupSummary> startupSummary) Controls the level of information logged during startup.Set application temporary directory.setTrustProxy
(boolean trustProxy) When true handles X-Forwarded-* headers by updating the values on the current context to match what was sent in the header(s).setVersion
(String version) Set application version.Set a worker thread pool.sse
(String pattern, ServerSentEmitter.Handler handler) Add a server-sent event handler.start()
Start application, find a web server, deploy application, start router, extension modules, etc..Call back method that indicates application was deploy it in the given server.stop()
Stop application, fire the stop event to cleanup resources.toString()
use
(Route.Filter filter) Attach a filter to the route pipeline.ws
(String pattern, WebSocket.Initializer handler) Add a websocket handler.
-
Constructor Details
-
Jooby
public Jooby()Creates a new Jooby instance.
-
-
Method Details
-
getServerOptions
Server options ornull
.- Specified by:
getServerOptions
in interfaceRouter
- Returns:
- Server options or
null
.
-
setServerOptions
Set server options.- Parameters:
serverOptions
- Server options.- Returns:
- This application.
-
getRouterOptions
Description copied from interface:Router
Router options.- Specified by:
getRouterOptions
in interfaceRouter
- Returns:
- Router options.
-
setRouterOptions
Description copied from interface:Router
Set router options.- Specified by:
setRouterOptions
in interfaceRouter
- Parameters:
options
- router options.- Returns:
- This router.
-
getEnvironment
Application environment. If none was set, environment is initialized usingEnvironment.loadEnvironment(EnvironmentOptions)
.- Specified by:
getEnvironment
in interfaceRouter
- Returns:
- Application environment.
-
getLocales
Returns the list of supported locales, ornull
if none set.- Specified by:
getLocales
in interfaceRouter
- Returns:
- The supported locales.
-
setLocales
Sets the supported locales.- Parameters:
locales
- The supported locales.- Returns:
- This router.
-
setLocales
Sets the supported locales.- Parameters:
locales
- The supported locales.- Returns:
- This router.
-
getClassLoader
Application class loader.- Returns:
- Application class loader.
-
getConfig
@NonNull public com.typesafe.config.Config getConfig()Application configuration. It is a shortcut forEnvironment.getConfig()
. -
setEnvironment
Set application environment.- Parameters:
environment
- Application environment.- Returns:
- This application.
-
setEnvironmentOptions
Set environment options and initialize/overrides the environment.- Parameters:
options
- Environment options.- Returns:
- New environment.
-
onStarting
Event fired before starting router and web-server. Non-lateinit extension are installed at this stage.- Parameters:
body
- Start body.- Returns:
- This application.
-
onStarted
Event is fire once all components has been initialized, for example router and web-server are up and running, extension installed, etc...- Parameters:
body
- Start body.- Returns:
- This application.
-
onStop
Stop event is fire at application shutdown time. Useful to execute cleanup task, free resources, etc...- Parameters:
body
- Stop body.- Returns:
- This application.
-
setContextPath
Description copied from interface:Router
Set application context path. Context path is the base path for all routes. Default is:/
.- Specified by:
setContextPath
in interfaceRouter
- Parameters:
basePath
- Context path.- Returns:
- This router.
-
getContextPath
Description copied from interface:Router
Get application context path (a.k.a as base path).- Specified by:
getContextPath
in interfaceRouter
- Returns:
- Application context path (a.k.a as base path).
-
install
Installs/imports a full application into this one. Applications share services, registry, callbacks, etc.Applications must be instantiated/created lazily via a supplier/factory. This is required due to the way an application is usually initialized (constructor initializer).
Working example:
Lazy creation configures and setupinstall(SubApp::new);
SubApp
correctly, the next example won't work:
Note: you must take care of application services across the applications. For example make sure you don't configure the same service twice or more in the main and imported applications too.SubApp app = new SubApp(); install(app); // WONT WORK
- Parameters:
factory
- Application factory.- Returns:
- This application.
-
install
Installs/imports a full application into this one. Applications share services, registry, callbacks, etc.Application must be instantiated/created lazily via a supplier/factory. This is required due to the way an application is usually initialized (constructor initializer).
Working example:
Lazy creation allows to configure and setupinstall("/subapp", SubApp::new);
SubApp
correctly, the next example won't work:
Note: you must take care of application services across the applications. For example make sure you don't configure the same service twice or more in the main and imported applications too.SubApp app = new SubApp(); install("/subapp", app); // WONT WORK
- Parameters:
path
- Path prefix.factory
- Application factory.- Returns:
- This application.
-
install
@NonNull public Jooby install(@NonNull String path, @NonNull Predicate<Context> predicate, @NonNull SneakyThrows.Supplier<Jooby> factory) Installs/imports a full application into this one. Applications share services, registry, callbacks, etc.Application must be instantiated/created lazily via a supplier/factory. This is required due to the way an application is usually initialized (constructor initializer).
Working example:
Lazy creation allows to configure and setupinstall("/subapp", ctx -> ctx.header("v").value("").equals("1.0"), SubApp::new);
SubApp
correctly, the next example won't work:
Note: you must take care of application services across the applications. For example make sure you don't configure the same service twice or more in the main and imported applications too.SubApp app = new SubApp(); install("/subapp", ctx -> ctx.header("v").value("").equals("1.0"), app); // WONT WORK
- Parameters:
path
- Sub path.predicate
- HTTP predicate.factory
- Application factory.- Returns:
- This application.
-
install
@NonNull public Jooby install(@NonNull Predicate<Context> predicate, @NonNull SneakyThrows.Supplier<Jooby> factory) Installs/imports a full application into this one. Applications share services, registry, callbacks, etc.Application must be instantiated/created lazily via a supplier/factory. This is required due to the way an application is usually initialized (constructor initializer).
Working example:
Lazy creation allows to configure and setupinstall(ctx -> ctx.header("v").value("").equals("1.0"), SubApp::new);
SubApp
correctly, the next example won't work:
Note: you must take care of application services across the applications. For example make sure you don't configure the same service twice or more in the main and imported applications too.SubApp app = new SubApp(); install(ctx -> ctx.header("v").value("").equals("1.0"), app); // WONT WORK
- Parameters:
predicate
- HTTP predicate.factory
- Application factory.- Returns:
- This application.
-
getRouter
The underlying router.- Returns:
- The underlying router.
-
isTrustProxy
public boolean isTrustProxy()Description copied from interface:Router
When true handles X-Forwarded-* headers by updating the values on the current context to match what was sent in the header(s).This should only be installed behind a reverse proxy that has been configured to send the
X-Forwarded-*
header, otherwise a remote user can spoof their address by sending a header with bogus values.The headers that are read/set are:
- X-Forwarded-For: Set/update the remote address
Context.setRemoteAddress(String)
. - X-Forwarded-Proto: Set/update request scheme
Context.setScheme(String)
. - X-Forwarded-Host: Set/update the request host
Context.setHost(String)
. - X-Forwarded-Port: Set/update the request port
Context.setPort(int)
.
- Specified by:
isTrustProxy
in interfaceRouter
- Returns:
- True when enabled. Default is false.
- X-Forwarded-For: Set/update the remote address
-
isStarted
public boolean isStarted() -
isStopped
public boolean isStopped() -
setTrustProxy
Description copied from interface:Router
When true handles X-Forwarded-* headers by updating the values on the current context to match what was sent in the header(s).This should only be installed behind a reverse proxy that has been configured to send the
X-Forwarded-*
header, otherwise a remote user can spoof their address by sending a header with bogus values.The headers that are read/set are:
- X-Forwarded-For: Set/update the remote address
Context.setRemoteAddress(String)
. - X-Forwarded-Proto: Set/update request scheme
Context.setScheme(String)
. - X-Forwarded-Host: Set/update the request host
Context.setHost(String)
. - X-Forwarded-Port: Set/update the request port
Context.setPort(int)
.
- Specified by:
setTrustProxy
in interfaceRouter
- Parameters:
trustProxy
- True to enable.- Returns:
- This router.
- X-Forwarded-For: Set/update the remote address
-
domain
Description copied from interface:Router
Enabled routes for specific domain. Domain matching is done using thehost
header.
NOTE: if you run behind a reverse proxy you might to enabled{ domain("foo.com", new FooApp()); domain("bar.com", new BarApp()); }
Router.setTrustProxy(boolean)
.NOTE: ONLY routes are imported. Services, callback, etc.. are ignored.
-
domain
Description copied from interface:Router
Enabled routes for specific domain. Domain matching is done using thehost
header.
NOTE: if you run behind a reverse proxy you might to enabled{ domain("foo.com", () -> { get("/", ctx -> "foo"); }); domain("bar.com", () -> { get("/", ctx -> "bar"); }); }
Router.setTrustProxy(boolean)
. -
mount
Description copied from interface:Router
Import routes from given action. Predicate works like a filter and only when predicate pass the routes match against the current request.Example of domain predicate filter:
NOTE: if you run behind a reverse proxy you might to enabled{ mount(ctx -> ctx.getHost().equals("foo.com"), () -> { get("/", ctx -> "foo"); }); mount(ctx -> ctx.getHost().equals("bar.com"), () -> { get("/", ctx -> "bar"); }); }
Router.setTrustProxy(boolean)
.NOTE: ONLY routes are imported. Services, callback, etc.. are ignored.
-
mount
Description copied from interface:Router
Import routes from given router. Predicate works like a filter and only when predicate pass the routes match against the current request.Example of domain predicate filter:
Imported routes are matched only when predicate pass.{ use(ctx -> ctx.getHost().equals("foo.com"), new FooApp()); use(ctx -> ctx.getHost().equals("bar.com"), new BarApp()); }
NOTE: if you run behind a reverse proxy you might to enabled
Router.setTrustProxy(boolean)
.NOTE: ONLY routes are imported. Services, callback, etc.. are ignored.
-
mount
Description copied from interface:Router
Import all routes from the given router and prefix them with the given path.NOTE: ONLY routes are imported. Services, callback, etc.. are ignored.
-
mount
Description copied from interface:Router
Import all routes from the given router.NOTE: ONLY routes are imported. Services, callback, etc.. are ignored.
-
mvc
Description copied from interface:Router
Import all route methods from given controller instance. -
mvc
Description copied from interface:Router
Import all route method from the given controller class. At runtime the controller instance is resolved by callingrequire(Class)
. -
mvc
@NonNull public <T> Jooby mvc(@NonNull Class<T> router, @NonNull jakarta.inject.Provider<T> provider) Description copied from interface:Router
Import all route method from the given controller class. -
ws
Description copied from interface:Router
Add a websocket handler. -
sse
Description copied from interface:Router
Add a server-sent event handler. -
getRoutes
Description copied from interface:Router
Returns all routes. -
error
Description copied from interface:Router
Add a custom error handler. -
use
Description copied from interface:Router
Attach a filter to the route pipeline. -
before
Description copied from interface:Router
Add a before route decorator to the route pipeline. -
after
Description copied from interface:Router
Add an after route decorator to the route pipeline. -
encoder
Description copied from interface:Router
Register a route response encoder. -
decoder
Description copied from interface:Router
Register a decoder for the given content type. -
encoder
Description copied from interface:Router
Register a route response encoder. -
install
Install extension module.- Parameters:
extension
- Extension module.- Returns:
- This application.
-
install
Set server to use.- Parameters:
server
- Web Server.- Returns:
- This application.
-
dispatch
Description copied from interface:Router
Dispatch route pipeline to theRouter.getWorker()
worker thread pool. After dispatch application code is allowed to do blocking calls. -
dispatch
Description copied from interface:Router
Dispatch route pipeline to the given executor. After dispatch application code is allowed to do blocking calls.- Specified by:
dispatch
in interfaceRouter
- Parameters:
executor
- Executor.ExecutorService
instances automatically shutdown at application exit.action
- Dispatch body.- Returns:
- This router.
-
path
Description copied from interface:Router
Group one or more routes under a common path prefix. Useful for applying cross-cutting concerns to the enclosed routes. -
routes
Description copied from interface:Router
Group one or more routes. Useful for applying cross cutting concerns to the enclosed routes. -
route
@NonNull public Route route(@NonNull String method, @NonNull String pattern, @NonNull Route.Handler handler) Description copied from interface:Router
Add a route. -
match
Description copied from interface:Router
Find a matching route using the given context.If no match exists this method returns a route with a
404
handler. SeeRoute.NOT_FOUND
. -
match
Description copied from interface:Router
Find a matching route using the given context.If no match exists this method returns a route with a
404
handler. SeeRoute.NOT_FOUND
. -
errorCode
@NonNull public Jooby errorCode(@NonNull Class<? extends Throwable> type, @NonNull StatusCode statusCode) Description copied from interface:Router
Map an exception type to a status code. -
errorCode
Description copied from interface:Router
Computes the status code for the given exception. -
getWorker
Description copied from interface:Router
Returns the worker thread pool. This thread pool is used to run application blocking code. -
setWorker
Description copied from interface:Router
Set a worker thread pool. This thread pool is used to run application blocking code. -
setDefaultWorker
Description copied from interface:Router
Set the default worker thread pool. Via this method the underlying web server set/suggests the worker thread pool that should be used it.A call to
Router.getWorker()
returns the default thread pool, unless you explicitly set one.- Specified by:
setDefaultWorker
in interfaceRouter
- Parameters:
worker
- Default worker thread pool.- Returns:
- This router.
-
getBufferFactory
- Specified by:
getBufferFactory
in interfaceRouter
-
setBufferFactory
- Specified by:
setBufferFactory
in interfaceRouter
-
getLog
@NonNull public org.slf4j.Logger getLog()Description copied from interface:Router
Application logger. -
resultHandler
Description copied from interface:Router
Add a response handler factory.- Specified by:
resultHandler
in interfaceRouter
- Parameters:
handler
- Response handler factory.- Returns:
- This router.
-
getErrorHandler
Description copied from interface:Router
Get the error handler.- Specified by:
getErrorHandler
in interfaceRouter
- Returns:
- An error handler.
-
getTmpdir
Description copied from interface:Router
Application temporary directory. This method initialize theEnvironment
when isn't set manually. -
setTmpdir
Set application temporary directory.- Parameters:
tmpdir
- Temp directory.- Returns:
- This application.
-
getExecutionMode
Application execution mode.- Returns:
- Application execution mode.
-
setExecutionMode
Set application execution mode.- Parameters:
mode
- Application execution mode.- Returns:
- This application.
-
getAttributes
Description copied from interface:Router
Mutable map of application attributes.- Specified by:
getAttributes
in interfaceRouter
- Returns:
- Mutable map of application attributes.
-
attribute
Description copied from interface:Router
Set an application attribute. -
attribute
Description copied from interface:Router
Get an attribute by his key. This is just a utility method aroundRouter.getAttributes()
. -
require
Description copied from interface:Registry
Provides an instance of the given type where name matches it. -
require
Description copied from interface:Registry
Provides an instance of the given type. -
require
Description copied from interface:Registry
Provides an instance of the given type. -
registry
Set application registry.- Parameters:
registry
- Application registry.- Returns:
- This application.
-
getServices
Description copied from interface:Router
Application service registry. Services are accessible via this registry orrequire(Class)
calls.This method returns a mutable registry. You are free to modify/alter the registry.
- Specified by:
getServices
in interfaceRouter
- Returns:
- Service registry.
-
getBasePackage
Get base application package. This is the package from where application was initialized or the package of a Jooby application sub-class.- Returns:
- Base application package.
-
setBasePackage
-
getSessionStore
Description copied from interface:Router
Session store. Default use a cookie ID with a memory storage.- Specified by:
getSessionStore
in interfaceRouter
- Returns:
- Session store.
-
setSessionStore
Description copied from interface:Router
Set session store.- Specified by:
setSessionStore
in interfaceRouter
- Parameters:
store
- Session store.- Returns:
- This router.
-
executor
Description copied from interface:Router
Put an executor into the application registry. -
getFlashCookie
Description copied from interface:Router
Template for the flash cookie. Default name is:jooby.flash
.- Specified by:
getFlashCookie
in interfaceRouter
- Returns:
- Template for the flash cookie.
-
setFlashCookie
Description copied from interface:Router
Sets a cookie used as a template to generate the flash cookie, allowing to customize the cookie name and other cookie parameters.- Specified by:
setFlashCookie
in interfaceRouter
- Parameters:
flashCookie
- The cookie template.- Returns:
- This router.
-
converter
Description copied from interface:Router
Add a custom string value converter. -
getConverters
Description copied from interface:Router
Get all simple/string value converters.- Specified by:
getConverters
in interfaceRouter
- Returns:
- All simple/string value converters.
-
getBeanConverters
Description copied from interface:Router
Get all complex/bean value converters.- Specified by:
getBeanConverters
in interfaceRouter
- Returns:
- All complex/bean value converters.
-
setHiddenMethod
Description copied from interface:Router
Provides a way to override the current HTTP method using lookup strategy.- Specified by:
setHiddenMethod
in interfaceRouter
- Parameters:
provider
- Lookup strategy.- Returns:
- This router.
-
setCurrentUser
Description copied from interface:Router
Provides a way to set the current user from aContext
. Current user can be retrieve it usingContext.getUser()
.- Specified by:
setCurrentUser
in interfaceRouter
- Parameters:
provider
- User provider/factory.- Returns:
- This router.
-
setContextAsService
Description copied from interface:Router
If enabled, allows to retrieve theContext
object associated with the current request via the service registry while the request is being processed.- Specified by:
setContextAsService
in interfaceRouter
- Parameters:
contextAsService
- whether to enable or disable this feature- Returns:
- This router.
-
setHiddenMethod
Description copied from interface:Router
Provides a way to override the current HTTP method. Request must be:- POST Form/multipart request
For alternative strategy use the
Router.setHiddenMethod(Function)
method.- Specified by:
setHiddenMethod
in interfaceRouter
- Parameters:
parameterName
- Form field name.- Returns:
- This router.
-
getStartupSummary
Controls the level of information logged during startup.- Returns:
- Controls the level of information logged during startup.
-
setStartupSummary
Controls the level of information logged during startup.- Parameters:
startupSummary
- Summary.- Returns:
- This instance.
-
start
Start application, find a web server, deploy application, start router, extension modules, etc..- Returns:
- Server.
-
start
Call back method that indicates application was deploy it in the given server.- Parameters:
server
- Server.- Returns:
- This application.
-
ready
Callback method that indicates application was successfully started it and listening for connections.- Parameters:
server
- Server.- Returns:
- This application.
-
stop
Stop application, fire the stop event to cleanup resources.This method is usually invoked by
Server.stop()
using a shutdown hook.The next example shows how to successfully stop the web server and application:
Jooby app = new Jooby(); Server server = app.start(); ... server.stop();
- Returns:
- This application.
-
setLateInit
Force all module to be initialized lazily at application startup time (not at creation/instantiation time).This option is present mostly for unit-test where you need to instantiated a Jooby instance without running extensions.
- Parameters:
lateInit
- True for late init.- Returns:
- This application.
-
getName
Get application's name. If none set:- Try to get from
Package.getImplementationTitle()
. - Otherwise fallback to class name.- Returns:
- Application's name.
-
setName
Set application name.- Parameters:
name
- Application's name.- Returns:
- This application.
-
getVersion
Get application version (description/debugging purpose only). If none set:- Try to get it from
Package.getImplementationVersion()
. This attribute is present when application has been packaged (jar file).- Otherwise, fallback to
0.0.0
.- Returns:
- Application version.
-
setVersion
Set application version.- Parameters:
version
- Application's version.- Returns:
- This application.
-
toString
-
runApp
Setup default environment, logging (logback or log4j2) and run application.- Parameters:
args
- Application arguments.provider
- Application provider.
-
runApp
Setup default environment, logging (logback or log4j2) and run application.- Parameters:
args
- Application arguments.consumer
- Application consumer.
-
runApp
public static void runApp(@NonNull String[] args, @NonNull ExecutionMode executionMode, @NonNull Consumer<Jooby> consumer) Setup default environment, logging (logback or log4j2) and run application.- Parameters:
args
- Application arguments.executionMode
- Application execution mode.consumer
- Application consumer.
-
runApp
public static void runApp(@NonNull String[] args, @NonNull ExecutionMode executionMode, @NonNull Supplier<Jooby> provider) Setup default environment, logging (logback or log4j2) and run application.- Parameters:
args
- Application arguments.executionMode
- Application execution mode.provider
- Application provider.
-
createApp
public static Jooby createApp(@NonNull String[] args, @NonNull ExecutionMode executionMode, @NonNull Supplier<Jooby> provider) Setup default environment, logging (logback or log4j2) and run application.- Parameters:
args
- Application arguments.executionMode
- Application execution mode.provider
- Application provider.- Returns:
- Application.
-