Hello
I have one question about Spring way of finding and initializing beans.
In my web application that is deployed to Tomcat 7.0 most of the beans are annotated with @Component annotation, so we don't have so much xml code.
During the startup of Tomcat I can see a message:
and there goes a long list of beans, like:Code:INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1172fb9:
and others from Spring, but among them I can see the names of the classes that I annotated with @Component.Code:org.springframework.security.filterChains
After those information I am getting info about mapping methods to URLs.
As far as I understand Spring configuration, it knows where to look for beans because I put
in my .xml configuration file.Code:<context:component-scan base-package="package.to.scan" />
But if I remove this line from the configuration file I am still getting this line about DefaultListableBeanFactory and list of beans,
Interesting thing is, that if I don't remove
I am gettingCode:<context:component-scan base-package="pl.meble.taboret" />
listed twice, like Spring is loading beans twice.Code:org.springframework.beans.factory.support.DefaultListableBeanFactory@1172fb9:
Apart from
how is it possible to point packages for Spring container to scan for beans?Code:<context:component-scan base-package="pl.meble.taboret" />
EDIT:
Sorry for all the fuss, it seems I had component-scan in two .xml files, so that is why beans were loaded twice.


Reply With Quote
