Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Injeção de dependências

Implementei conforme a aula de Injeção de independências, mas não consegui fazer o sistema funcionar.

Segue o erro apresentado no console:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'contaController' defined in file [/Users/nlajunior/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/contas/WEB-INF/classes/br/com/caelum/contas/controller/ContaController.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [br.com.caelum.contas.dao.ContaDAO]: : Error creating bean with name 'contaDAO' defined in file [/Users/nlajunior/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/contas/WEB-INF/classes/br/com/caelum/contas/dao/ContaDAO.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.apache.tomcat.jdbc.pool.DataSource]: : No qualifying bean of type [org.apache.tomcat.jdbc.pool.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.tomcat.jdbc.pool.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'contaDAO' defined in file [/Users/nlajunior/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/contas/WEB-INF/classes/br/com/caelum/contas/dao/ContaDAO.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.apache.tomcat.jdbc.pool.DataSource]: : No qualifying bean of type [org.apache.tomcat.jdbc.pool.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.apache.tomcat.jdbc.pool.DataSource] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {} at or

2 respostas

Oi Nilo,

Cola seu código aqui. O bean está configurado direitinho no spring.xml?

Um abraço!

solução!

Oi Mauricio.

Eu exclui o meu workspace e importei novamente o projeto. Depois desse procedimento, tudo funcionou novamente.

Obrigado.