Interface ApplicationContext

All Superinterfaces:
AnnotationMetadataResolver, ApplicationEventPublisher<Object>, AttributeHolder, AutoCloseable, BeanContext, BeanDefinitionRegistry, BeanLocator, Closeable, ConversionServiceProvider, ExecutionHandleLocator, LifeCycle<BeanContext>, MutableAttributeHolder, PropertyPlaceholderResolver, PropertyResolver, ValueResolver<String>
All Known Subinterfaces:
All Known Implementing Classes:

public interface ApplicationContext extends BeanContext, PropertyResolver, PropertyPlaceholderResolver

An application context extends a BeanContext and adds the concepts of configuration, environments and runtimes.

The ApplicationContext is the main entry point for starting and running Micronaut applications. It can be thought of as a container object for all dependency injected objects.

The ApplicationContext can be started via the run() method. For example:

     ApplicationContext context =;

Alternatively, the builder() method can be used to customize the ApplicationContext using the ApplicationContextBuilder interface prior to running. For example:

     ApplicationContext context = ApplicationContext.builder().environments("test").start();

The getEnvironment() method can be used to obtain a reference to the application Environment, which contains the loaded configuration and active environment names.

Graeme Rocher
See Also: