Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

236
Views
Ningún bean calificado del tipo ScheduledExecutorService | Programador de tareas

Aquí está la configuración de programación

 @Configuration @EnableScheduling public class RWInventorySchedule { protected org.slf4j.Logger log = LoggerFactory.getLogger(RWInventorySchedule.class); @PersistenceContext private EntityManager entityManager; @Bean public RWInventoryProcessor constructInventoryProcessor() { log.debug("RWInventorySchedule constructs InventoryProcessor, entityManager : {} " , entityManager); return new RWInventoryProcessor(entityManager); } }

Procesador de inventario es el siguiente

 public class RWInventoryProcessor { ... @Scheduled(fixedRate = 5000,initialDelay = 3000) @Transactional public void runProcess() { ... } }

Durante la ejecución, se obtienen los siguientes errores en el registro de depuración

DEPURAR org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor: no se pudo encontrar el bean TaskScheduler predeterminado

...
DEPURAR org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor: no se pudo encontrar el bean predeterminado ScheduledExecutorService org.springframework.beans.factory.NoSuchBeanDefinitionException: no hay bean calificador del tipo 'java.util.concurrent.ScheduledExecutorService' disponible

¿Me estoy perdiendo algo?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Si está utilizando la configuración de Java, necesita una definición de @Bean para el tipo de planificador que desea utilizar. Spring no tiene un bean predeterminado para esto. Por ejemplo

 @Bean public TaskScheduler taskScheduler() { return new ConcurrentTaskScheduler(); //single threaded by default }
over 4 years ago · Santiago Trujillo Report

0

He usado este formulario en mi configuración xml Spring:

 <task:annotation-driven executor="executor" /> <task:scheduler id="scheduler" pool-size="10"/> <task:executor id="executor" pool-size="7"/>

Mi procesador de componentes es:

 @Component public class QueueConsumer { @Autowired ProcessQueue queue; @Autowired TaskProcessor processor; @Autowired TaskResultRepository resultRepository; @Scheduled(fixedDelay = 15000) public void runJob() { ProcessTask task = queue.poll(); ... } }

Necesita la anotación equivalente a <task:scheduler id="scheduler" pool-size="10"/>

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!