I was writing one bean in my spring boot application which had one class variable. That raised a doubt in my mind about how does spring boot handle multiple concurrent request. Let's say we have multiple users using our application but when the application is deployed on server, only one instance is created of a class. So how does that class handle multiple requests ? Let's say millions of concurrent request from user?
Consider the example below:
public class SampleBean {
private Integer dummyVariable = null;
public void dummyFunction() {
//some computation on dummyVarible
dummyVariable += 10;
//dummy code
dummyVariable = null;
}
}
So when a user1 enters in dummyFunction for first time and the value is null. But then some computation is done on it and it value changes but before returning from the function user2 also enters in dummyFunction then the value of dummyVariable will be null or it will be altered by user1?
Also, can someone share some article to understand this whole concept of concurrent requests handling on sprint boot?