Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
Can I create a Spring context within a Quartz job or it is a terrible idea?

I am new to Quartz and I am going to write jobs that require a lot of services/dependencies.

Would it make sense to create a Spring context in the job execute method (so for any new job there will a new Spring context) or is it better to create a unique Spark context before the jobs get created and inject services for any new job?

Thank you.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

That depends on your requirements and preferences.

If your job only starts at a determined time of the day, something like everyday at 3:00 am. Then it's not important that your spring context takes to starts a couple of minutes. In this case or any other case where it's not important the time until the context is up and running, I suggest you to start the context every time a job is started. It has no sense to keep a context up and running along the hole day if you only will use it a little part of it.

However, you can have a lot of jobs. And probably it does not matter the time they take to be up and running. But if they are many, it will use a lot of memory starting a new context for every job. So, in this case I would recommend you to init a unique spring context. So you can optimize the memory of your server.

Other case, would be that the start up time matters. In this case, it's better to have the spring context up and running, so you can use it, every time you need almost immediately.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda