Class AnnotationConfigApplicationContext

All Implemented Interfaces:
Closeable, AutoCloseable, BeanFactory, HierarchicalBeanFactory, ListableBeanFactory, BeanDefinitionRegistry, AnnotationConfigRegistry, ApplicationContext, ApplicationEventPublisher, ConfigurableApplicationContext, Lifecycle, MessageSource, AliasRegistry, EnvironmentCapable, ResourceLoader, ResourcePatternResolver

public class AnnotationConfigApplicationContext extends GenericApplicationContext implements AnnotationConfigRegistry
Standalone application context, accepting component classes as input — in particular @Configuration-annotated classes, but also plain @Component types and JSR-330 compliant classes using jakarta.inject annotations.

Allows for registering classes one by one using register(Class...) as well as for classpath scanning using scan(String...).

In case of multiple @Configuration classes, @Bean methods defined in later classes will override those defined in earlier classes. This can be leveraged to deliberately override certain bean definitions via an extra @Configuration class.

See @Configuration's javadoc for usage examples.

Since:
3.0
Author:
Juergen Hoeller, Chris Beams
See Also: