If I understand your requirement, you need WebDriver
to be shared between a Job
and LocationChanger
. So it's not prototype
scope, and it's not singleton
scope. To solve this, I think you either have to do it by hand, as you suggest, or you could try to implement your own scope, as described in the Spring reference documentation
Edit
I don't think you "handwired" solution looks that bad BTW.