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

159
Visualizações
Spring make all beans prototype by default based on configuration?

I have spring beans services defined in xml which are singleton. They take a long time to load. What i want a configuration(may be in XML or property file) where i can make all beans as prototype by default based on that configuration/property so that they can load faster.

Is there any configuration like this in spring ?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

It looks like you could implement something like this by creating an instance of BeanFactoryPostProcessor as described here: https://dzone.com/articles/changing-default-spring-bean

In that implementation, any beans without an explicit scope would be have prototype scope.

This is similar to this approah (almost a duplicate of your question) How to specify the default scope in Spring's applicationContext.xml to request scope?

Note the caveats in that post, however, that this approach does not consider ancestor factories, which may or may not be a consideration in your case.

over 4 years ago · Santiago Trujillo Relatório

0

Load it in Servlet Context in XML configuration, that may help you to speed up singleton object creation, as per my opinion.

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