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: