Annotation Type Parallel
-
@Documented @Retention(RUNTIME) @Target({METHOD,TYPE,ANNOTATION_TYPE}) public @interface Parallel
A hint annotation that can be added to
Bean
definitions orExecutable
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 theApplicationContext
as they may be initialized after theApplicationContext
has started and cannot participate inStartupEvent
processing. If a parallel bean fails to startup it will by default stop theApplicationContext
with an error unlessshutdownOnError()
set to tofalse
.Adding
Parallel
to methods is most useful when used in conjunction with aExecutableMethodProcessor
. 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 nonPrototype
scopes such asSingleton
andContext
- Since:
- 1.0
- See Also:
Context
,Executable
,ExecutableMethodProcessor
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
shutdownOnError
The default behaviour is to shutdown the context if an error occurs on initialization.
-