Class Micronaut
java.lang.Object
io.micronaut.context.DefaultApplicationContextBuilder
io.micronaut.runtime.Micronaut
- All Implemented Interfaces:
io.micronaut.context.ApplicationContextBuilder, io.micronaut.context.ApplicationContextConfiguration, io.micronaut.context.BeanContextConfiguration
@NullMarked
public class Micronaut
extends io.micronaut.context.DefaultApplicationContextBuilder
implements io.micronaut.context.ApplicationContextBuilder
Main entry point for running a Micronaut application.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbanner(boolean isEnabled) beanDefinitions(io.micronaut.context.RuntimeBeanDefinition<?>... definitions) static MicronautRun the application for the given arguments.Add classes to be included in the initialization of the application.classLoader(@Nullable ClassLoader classLoader) configurationLoadingStrategy(io.micronaut.core.io.ResourceLoadStrategy.Builder builder) defaultEnvironments(String @Nullable ... environments) environmentPropertySource(boolean environmentPropertySource) environments(String @Nullable ... environments) environmentVariableExcludes(String @Nullable ... environmentVariables) environmentVariableIncludes(String @Nullable ... environmentVariables) protected voidhandleStartupException(io.micronaut.context.env.Environment environment, Throwable exception) Default handling of startup exceptions.Maps an exception to the given error code.properties(@Nullable Map<String, Object> properties) propertySources(io.micronaut.context.env.PropertySource @Nullable ... propertySources) static io.micronaut.context.ApplicationContextRun the application for the given arguments.static io.micronaut.context.ApplicationContextRun the application for the given arguments.static io.micronaut.context.ApplicationContextRun the application for the given arguments.singletons(Object @Nullable ... beans) io.micronaut.context.ApplicationContextstart()Methods inherited from class io.micronaut.context.DefaultApplicationContextBuilder
allowEmptyProviders, beanConfiguraionsPredicate, beanConfigurations, beanConfigurationsPredicate, beanDefinitionsProvider, beanResolutionCustomizer, beanResolutionCustomizer, beanResolutionTrace, beansPredicate, beansPredicate, bootstrapEnvironment, build, configImport, customScopeRegistry, customScopeRegistryFactory, deduceCloudEnvironment, deduceEnvironment, deducePackage, eagerBeansEnabled, eagerBeansEnabled, eagerInitAnnotated, enableDefaultPropertySources, eventsEnabled, eventsEnabled, getBeanDefinitionsProvider, getClassLoader, getConfigurationLoadingStrategy, getContextConfigurer, getDeduceEnvironments, getDefaultEnvironments, getEagerInitAnnotated, getEnvironments, getEnvironmentVariableExcludes, getEnvironmentVariableIncludes, getOverrideConfigLocations, getPropertySourcesLocators, getResourceLoader, getTraceConfiguration, isAllowEmptyProviders, isBannerEnabled, isBootstrapEnvironmentEnabled, isConfigImportEnabled, isDeduceCloudEnvironment, isDeducePackage, isEnableDefaultPropertySources, isEnvironmentPropertySource, newApplicationContext, overrideConfigLocations, propertySourcesLocator, resourceResolverMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.context.ApplicationContextBuilder
allowEmptyProviders, beanConfigurations, beanConfigurationsPredicate, beanDefinitionsProvider, beanResolutionCustomizer, beanResolutionTrace, beanResolutionTrace, beansPredicate, bootstrapEnvironment, build, configImport, customScopeRegistry, deduceCloudEnvironment, deduceEnvironment, deducePackage, eagerBeansEnabled, eagerInitAnnotated, eagerInitConfiguration, eagerInitSingletons, enableDefaultPropertySources, eventsEnabled, overrideConfigLocations, propertySourcesLocator, resourceResolver, runMethods inherited from interface io.micronaut.context.ApplicationContextConfiguration
getApplicationName, getConversionService, getEnvironmentNamesDeducer, getPackageDeducerMethods inherited from interface io.micronaut.context.BeanContextConfiguration
isEagerInitConfiguration, isEagerInitSingletons
-
Constructor Details
-
Micronaut
protected Micronaut()The default constructor.
-
-
Method Details
-
start
public io.micronaut.context.ApplicationContext start()- Specified by:
startin interfaceio.micronaut.context.ApplicationContextBuilder- Returns:
- Run this
Micronaut
-
include
-
exclude
-
banner
- Specified by:
bannerin interfaceio.micronaut.context.ApplicationContextBuilder- Overrides:
bannerin classio.micronaut.context.DefaultApplicationContextBuilder
-
classes
-
properties
-
singletons
-
beanDefinitions
- Specified by:
beanDefinitionsin interfaceio.micronaut.context.ApplicationContextBuilder- Overrides:
beanDefinitionsin classio.micronaut.context.DefaultApplicationContextBuilder
-
propertySources
public Micronaut propertySources(io.micronaut.context.env.PropertySource @Nullable ... propertySources) - Specified by:
propertySourcesin interfaceio.micronaut.context.ApplicationContextBuilder- Overrides:
propertySourcesin classio.micronaut.context.DefaultApplicationContextBuilder
-
environmentPropertySource
- Specified by:
environmentPropertySourcein interfaceio.micronaut.context.ApplicationContextBuilder- Overrides:
environmentPropertySourcein classio.micronaut.context.DefaultApplicationContextBuilder
-
environmentVariableIncludes
-
environmentVariableExcludes
-
mainClass
-
classLoader
- Specified by:
classLoaderin interfaceio.micronaut.context.ApplicationContextBuilder- Overrides:
classLoaderin classio.micronaut.context.DefaultApplicationContextBuilder
-
args
-
environments
-
configurationLoadingStrategy
public Micronaut configurationLoadingStrategy(io.micronaut.core.io.ResourceLoadStrategy.Builder builder) - Specified by:
configurationLoadingStrategyin interfaceio.micronaut.context.ApplicationContextBuilder- Overrides:
configurationLoadingStrategyin classio.micronaut.context.DefaultApplicationContextBuilder
-
defaultEnvironments
-
packages
-
mapError
-
build
-
run
Run the application for the given arguments. Classes for the application will be discovered automatically- Parameters:
args- The arguments- Returns:
- The
ApplicationContext
-
run
-
run
-
handleStartupException
protected void handleStartupException(io.micronaut.context.env.Environment environment, Throwable exception) Default handling of startup exceptions.- Parameters:
environment- The environmentexception- The exception- Throws:
ApplicationStartupException- If the server cannot be shutdown with an appropriate exist code
-