i\'ve problems in order to autowire a service in my controller. I\'ve this error:
org.springframework.beans.factory.BeanCreationException: Error creating bean wi
Your configuration is very strange...
I don't see root web application context configuration in your web.xml
. Could it be that you forgot to add this piece of code?
contextConfigLocation
WEB-INF/app-config.xml
org.springframework.web.context.ContextLoaderListener
Bit of Spring theory - Spring uses application context hierarchy for web applications:
ContextLoaderListener
DispatcherServlet
instancesWhen a new bean is being instantiated, it can get dependencies either from the context where it is being defined or from parent context. This makes possible to define common beans in the root context (services, DAO, ...) and have the request handling beans in servlet application contexts as each servlet can have its own set of controllers, view handers, ...
You are configuring MVC in your root context. That is just wrong. Remove the
You are also registering your controllers in the root context via the
on your base package. Make the component scan just on the services
package or separate your classes into two top level packages core
(for the root beans) and servlet
(for servlet beans).