I am a bit puzzled about Spring bean-scanning.
AFAIK I need to put <context:component-scan base-package="some.package" />
and Spring will search from the root of a given package for beans.
But now in my application, if I delete this line from .xml configuration file, and start up Tomcat I get
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4dd1b: defining beans
and then I get a long list of beans, some of them are from Spring, but also there are those that would I would expect to see with <context:component-scan base-package="some.package" />
added to config file. The only thing that is different between both logs, is the mapping of the controller methods to addresses. Methods are not mapped if this line is not present.
Why Spring is detecting those beans? What is making Spring scan my packages for annotated classes?
If it is relevant I am using Spring 3
EDIT:
if I don't remove <context:component-scan base-package="some.package" />
I am getting information about pre-instantiating singletons twice. So it looks like those beans are scanned two times.
EDIT: It seems that in one of the files loaded by ContextListener I had component-scan. That is why I had those beans listed twice.