Dedicated Spring Container vs Spring Scope

41 Views Asked by At

What are pros and cons of implementing a custom scope vs using a dedicated child container for an independent job execution?

I'm implementing a complex business functionality that needs a couple of dedicated beans. So far I managed fine to create objects with custom factories or object providers in prototype scope per execution and keep others stateless as singleton beans, but as complexity rises, I want to get a better container support for my job executions.

I did a project some time ago, where I implemented a custom scope. We used a thread scope that's inherited by child threads, so we only needed to ensure that the job was executed in it's own thread graph.

My last project used spring batch for batch job execution. In the spring batch docs I read the recommendation to use a child container per job, once thing's are starting to get complex. Additionally, it provides JobScope and StepScope.

I would be really interested in performance statistics and complexity experience?

0

There are 0 best solutions below