Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda