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

154
Views
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 answers
Answer question

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 Report

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 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!