configuration - duplication in parsing spring context -
nowadays i've got know spring mvc. about
context:component-scan
and
mvc:annotation-driven
and
tx:annotation-driven
in spring config xml
here question. know, "context:component-scan" scans beans. , heard, mvc:annotation-driven, tx:annotation-driven"s scan beans.
i think not efficient , not reasonable.
why scan twice, 3 times.
is there way avoid duicate parsing?
any answer appreciated. thank you.
in opinion, scanning process not twice, 3 times think.
declare related beans think.
please refer below summarize , find out how differences.
<context:annotation-config> declares support general annotations such @required, @autowired, @postconstruct, , on. <context:component-scan> can <context:annotation-config> <context:component-scan> scans packages find , register beans within application context.
<mvc:annotation-driven /> enables spring mvc @controller programming model , declares explicit support annotation-driven mvc controllers (i.e. @requestmapping, @controller, although support default behaviour), adding support declrative validation via @valid , message body marshalling @requestbody/responsebody.
<tx:annotation-driven /> provide transaction-manager instace directly within element. annotation-config , component-scan won't.
Comments
Post a Comment