We have a class at work with a main method that is run from a UNIX shell script. From what I understand it runs fine if it is started once but has problems if 2 of them are running at the same time.
The class might be something like this:
As you can see the class uses Spring for dependency injection.
The question is, if two MainClass objects are running at the same time on the same server will Spring inject the same AnotherClass object (scoped as a Singleton) into both MainClass objects that are running?
Would the two MainClass objects be running in their own JVM so Spring would inject a unique AnotherClass object into each of them?
I'm not sure how this would work. Any suggestions?