Annotation Interface Parallel
A hint annotation that can be added to Bean
definitions or Executable
methods to indicate that they can be initialized in
parallel with the application context.
This allows optimized startup time by allowing beans that have slow initialization paths to startup and without impacting the overall startup time of the application.
Note that beans and methods that are processed in parallel (unlike Context
scoped beans) will not initially fail the startup of the ApplicationContext
as they may be initialized after the ApplicationContext
has started and cannot participate in StartupEvent
processing. If a parallel bean fails to startup it will by default stop the ApplicationContext
with an error unless shutdownOnError()
set to to false
.
Adding Parallel
to methods is most useful when used in conjunction with a ExecutableMethodProcessor
. Be aware however, that the processor in this case should be thread safe as could be executed in parallel for different methods.
NOTE: The use of Parallel
generally only makes sense when combined with non Prototype
scopes such as Singleton
and Context
- Since:
- 1.0
- Author:
- graemerocher
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
The default behaviour is to shutdown the context if an error occurs on initialization.
-
Element Details
-
shutdownOnError
boolean shutdownOnErrorThe default behaviour is to shutdown the context if an error occurs on initialization. Can be set false if shutdown is not required.- Returns:
- Whether to shutdown the application if an error occurs.
- Default:
- true
-