Segue o código:
Task:
@PrototypeScoped
@Scheduled(cron = "* 0/1 * * * ?")
public class HelloTask implements Task {
private ManagerServiceUser managerUser;
HelloTask(ManagerServiceUser managerUser) {
this.managerUser = managerUser;
}
ManagerServiceUser:
@Component
public class ManagerServiceUser {
}
Erro:
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helloTask': Unsatisfied dependency expressed through constructor argument with index 0 of type [gov.br.ufla.urubu.managers.ManagerServiceUser]: : Error creating bean with name 'managerServiceUser': Unsatisfied dependency expressed through constructor argument with index 0 of type [gov.br.ufla.urubu.services.DAO.ServiceUserDAO]: : Error creating bean with name 'serviceUserDAOImpl': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceUserDAOImpl': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'managerServiceUser': Unsatisfied dependency expressed through constructor argument with index 0 of type [gov.br.ufla.urubu.services.DAO.ServiceUserDAO]: : Error creating bean with name 'serviceUserDAOImpl': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceUserDAOImpl': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
Já tentei mudar várias anotações, mas sem sucesso.
Obrigado.