Praticamente desde o começo do curso que meu projeto não funciona corretamente,
Já abri uns 2 tópicos aqui no fórum e nada, então agora na ultima aula
do curso de spring mvc 1 decidi baixar o projeto completo do curso pra
ver se funcionava, mas é isso o que aparece no meu console logo que rodo
o servidor:
SEVERE: Servlet.init() for servlet [SpringDispatcher] threw exception
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pagamentoController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.web.client.RestTemplate br.com.programingbooks.controller.PagamentoController.restTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
...
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.springframework.web.client.RestTemplate br.com.programingbooks.controller.PagamentoController.restTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
...
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
...
SEVERE: Servlet [SpringDispatcher] in web application [/programingbooks] threw load() exception
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.web.client.RestTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Só para comparação, o erro que da no projeto que eu escrevi é igual exceto pelo final,
enquanto que no projeto baixado aparece isso:
WARNING: The web application [programingbooks] registered the JDBC driver [com.mysql.cj.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
dez 03, 2019 2:52:42 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
WARNING: The web application [programingbooks] appears to have started a thread named [mysql-cj-abandoned-connection-cleanup] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.base@12.0.2/java.lang.Object.wait(Native Method)
java.base@12.0.2/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:155)
com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:85)
java.base@12.0.2/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java.base@12.0.2/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
java.base@12.0.2/java.lang.Thread.run(Thread.java:835)
no meu aparece isso:
Hibernate: alter table Product_preços drop foreign key FK_2ytx0bjix3jc13fywme06sujd
Hibernate: drop table if exists Product
Hibernate: drop table if exists Product_preços
Hibernate: create table Product (id integer not null auto_increment, desc varchar(255), paginas integer, titulo varchar(255), primary key (id))
Hibernate: create table Product_preços (Product_id integer not null, tipo integer, valor decimal(19,2))
Hibernate: alter table Product_preços add constraint FK_2ytx0bjix3jc13fywme06sujd foreign key (Product_id) references Product (id)