public class Micronaut extends DefaultApplicationContextBuilder implements ApplicationContextBuilder
Main entry point for running a Micronaut application.
| Modifier | Constructor and Description |
|---|---|
protected |
Micronaut()
The default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Micronaut |
args(String... args)
Set the command line arguments.
|
static Micronaut |
build(String... args)
Run the application for the given arguments.
|
Micronaut |
classes(Class... classes)
Add classes to be included in the initialization of the application.
|
Micronaut |
classLoader(ClassLoader classLoader)
The class loader to be used.
|
Micronaut |
environmentPropertySource(boolean environmentPropertySource)
Set whether environment variables should contribute to configuration.
|
Micronaut |
environments(String... environments)
The environments to use.
|
Micronaut |
environmentVariableExcludes(String... environmentVariables)
Which environment variables should not contribute to configuration.
|
Micronaut |
environmentVariableIncludes(String... environmentVariables)
Which environment variables should contribute to configuration.
|
Micronaut |
exclude(String... configurations)
Allow customizing the configurations that will be loaded.
|
protected void |
handleStartupException(Environment environment,
Throwable exception)
Default handling of startup exceptions.
|
Micronaut |
include(String... configurations)
Allow customizing the configurations that will be loaded.
|
Micronaut |
mainClass(Class mainClass)
The main class used by this application.
|
<T extends Throwable> |
mapError(Class<T> exception,
Function<T,Integer> mapper)
Maps an exception to the given error code.
|
Micronaut |
packages(String... packages)
The packages to include for package scanning.
|
Micronaut |
properties(Map<String,Object> properties)
Properties to override from the environment.
|
Micronaut |
propertySources(PropertySource... propertySources)
Additional property sources.
|
static ApplicationContext |
run(Class[] classes,
String... args)
Run the application for the given arguments.
|
static ApplicationContext |
run(Class cls,
String... args)
Run the application for the given arguments.
|
static ApplicationContext |
run(String... args)
Run the application for the given arguments.
|
Micronaut |
singletons(Object... beans)
Additional singletons to register prior to startup.
|
ApplicationContext |
start()
Starts the
ApplicationContext. |
build, deduceEnvironment, getClassLoader, getDeduceEnvironments, getEnvironments, getEnvironmentVariableExcludes, getEnvironmentVariableIncludes, getResourceLoader, isEnvironmentPropertySourceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuild, deduceEnvironment, rungetConversionService@Nonnull public ApplicationContext start()
ApplicationContextBuilderApplicationContext.start in interface ApplicationContextBuilderMicronaut@Nonnull public Micronaut include(@Nullable String... configurations)
DefaultApplicationContextBuilderinclude in interface ApplicationContextBuilderinclude in class DefaultApplicationContextBuilderconfigurations - The configurations to include@Nonnull public Micronaut exclude(@Nullable String... configurations)
DefaultApplicationContextBuilderexclude in interface ApplicationContextBuilderexclude in class DefaultApplicationContextBuilderconfigurations - The configurations to exclude@Nonnull public Micronaut classes(@Nullable Class... classes)
classes - The application@Nonnull public Micronaut properties(@Nullable Map<String,Object> properties)
ApplicationContextBuilderproperties in interface ApplicationContextBuilderproperties in class DefaultApplicationContextBuilderproperties - The properties@Nonnull public Micronaut singletons(Object... beans)
ApplicationContextBuildersingletons in interface ApplicationContextBuildersingletons in class DefaultApplicationContextBuilderbeans - The beans@Nonnull public Micronaut propertySources(@Nullable PropertySource... propertySources)
ApplicationContextBuilderpropertySources in interface ApplicationContextBuilderpropertySources in class DefaultApplicationContextBuilderpropertySources - The property sources to include@Nonnull public Micronaut environmentPropertySource(boolean environmentPropertySource)
ApplicationContextBuilderenvironmentPropertySource in interface ApplicationContextBuilderenvironmentPropertySource in class DefaultApplicationContextBuilderenvironmentPropertySource - The boolean@Nonnull public Micronaut environmentVariableIncludes(@Nullable String... environmentVariables)
ApplicationContextBuilderenvironmentVariableIncludes in interface ApplicationContextBuilderenvironmentVariableIncludes in class DefaultApplicationContextBuilderenvironmentVariables - The environment variables@Nonnull public Micronaut environmentVariableExcludes(@Nullable String... environmentVariables)
ApplicationContextBuilderenvironmentVariableExcludes in interface ApplicationContextBuilderenvironmentVariableExcludes in class DefaultApplicationContextBuilderenvironmentVariables - The environment variables@Nonnull public Micronaut mainClass(Class mainClass)
ApplicationContextBuildermainClass in interface ApplicationContextBuildermainClass in class DefaultApplicationContextBuildermainClass - The main class@Nonnull public Micronaut classLoader(ClassLoader classLoader)
ApplicationContextBuilderclassLoader in interface ApplicationContextBuilderclassLoader in class DefaultApplicationContextBuilderclassLoader - The classloader@Nonnull public Micronaut args(@Nullable String... args)
args - The arguments@Nonnull public Micronaut environments(@Nullable String... environments)
ApplicationContextBuilderenvironments in interface ApplicationContextBuilderenvironments in class DefaultApplicationContextBuilderenvironments - The environments@Nonnull public Micronaut packages(@Nullable String... packages)
ApplicationContextBuilderpackages in interface ApplicationContextBuilderpackages in class DefaultApplicationContextBuilderpackages - The packagespublic <T extends Throwable> Micronaut mapError(Class<T> exception, Function<T,Integer> mapper)
T - The exception typeexception - The exceptionmapper - The mapperpublic static Micronaut build(String... args)
args - The argumentsApplicationContextpublic static ApplicationContext run(String... args)
args - The argumentsApplicationContextpublic static ApplicationContext run(Class cls, String... args)
cls - The application classargs - The argumentsApplicationContextpublic static ApplicationContext run(Class[] classes, String... args)
classes - The application classesargs - The argumentsApplicationContextprotected void handleStartupException(Environment environment, Throwable exception)
environment - The environmentexception - The exceptionApplicationStartupException - If the server cannot be shutdown with an appropriate exist code