@Configuration
is a class-level annotation indicating that an object is a source of bean definitions. @Configuration
classes declare beans through @Bean
-annotated methods. Calls to @Bean
methods on @Configuration
classes can
also be used to define inter-bean dependencies. The @Bean
annotation indicates that a method instantiates, configures, and initializes a
new object to be managed by the Spring IoC container.
Annotating a method of a bean with @Async
will make it execute in a separate thread. In other words, the caller will not wait for the
completion of the called method.
The @Async
annotation is not supported on methods declared within a @Configuration
class. This is because
@Async
methods are typically used for asynchronous processing, and they require certain infrastructure to be set up, which may not be
available or appropriate in a @Configuration
class.