Spring order of @component creation -
in order @component classes created in spring. @configuration annotated class created first ?? can specify order of creation ??
@component
, @configuration
different types of annotations.
@component
, similar annotations (@service
, @repository
, etc. ) , jsr-330 counterpart , allow declare beans picked autoscanning <context:component-scan/>
or @componentscan
register bean definition classes, equivalent declaring specified beans <bean ... />
tag in xml. bean types adhere standard proxy creation policies.
@configuration
annotation designed replacement of xml configuration file. create @configuration
annotated beans, spring use cglib subclass @configuration
annotated class, overriding @bean
annotated method replace bean lookup method make singleton beans created once. despite that, @configuration
annotated classes still able use annotated(@autowired
, @inject
etc.) fields , properties request beans (and other @configuration
annotated beans too) container.
now answer question, have annotate class @configuration
, @componentscan(basepackages = { "com.test.*" })
, can't specify order of creation.
Comments
Post a Comment