The application context is the central interface for component injection.
The application context has a lifecycle that determines what type of operation can be performed with the application context.
The lifecycle can be describe as the following steps:
- the context configuration phase
- the context start
- the execution phase
- the context stop
The context gets configured and, once started, becomes read-only.
Not documented yet.
While an application context can be configured programmatically, the same result can be obtained declaratively.
This is achieved through the AnnotationConfigApplicationContext
class.
Annotation-based configuration makes it possible to:
- declare components that need to be registered, via the
@ComponentScan
decorator - declare other configurations that are dependencies, via the
@Import
decorator - provide component instances via methods annotated with a
@Component
decorator
More information regarding annotation-based configuration can be found in the Annotation-based Configuration chapter.
Not documented yet.
Not documented yet.