My application is correctly running with:
<context:component-scan base-package="com.mypackage"> </context:component-scan>
When I replace this by the manual bean definition the Controllers are not detected anymore.
In any of the cases I'm using those annotations:
<context:annotation-config />
<mvc:annotation-driven />
The autowired methods of the controllers are called but the beans are not declared as entrypoints, thus, 404 error and not accessible.
What is the black magic behind component scan?
Controllers are declared like that:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Controller configuration -->
<bean class="com.xx.ControllerClass" />
</beans>