Reputation: 33
I using annotation configuration for spring context like
<context:annotation-config/>
<context:component-scan base-package="example"/>
But project is fairly large and scanning for both components have much time (10 s for one scan). Can I configure this in only one scan, that is proceeded in ?
Upvotes: 3
Views: 1369
Reputation: 6229
I think the base-package
value can actually contain multiple packages. Try specifying something like:
<context:component-scan base-package="example.package.one,example.package.two"/>
Where you are explicitly specifying only the packages you need.
Upvotes: 3
Reputation: 597382
10s is not much time at all, because it is performed only once - on startup. You can limit the scanned packages by specifying more detailed package names (not just example
).
You mention "both" - if you have only 2 spring beans, just list them with <bean>
in the XML and drop the component scan.
Upvotes: 2