How spring serves a singleton bean to multiple requests at once

For Spring, what if I have two queries that access a singleton bean at the same time? Should one request wait for another to finish. How does Spring container find singleton bean instance for my requests?

For servlets, if I have two queries that access the normal normal class methods (without static other complex things) at the same time? Should one request wait until the other completes to avoid concurrency (at the same time, two requests try to access an object of the same class). How does a web container find an instance for my requests?

+4
source share
1 answer

Spring, , singleton bean ? , ?

Spring singleton bean (, Controller, Service class ..). Java , . singleton Spring, - /.

, (.. ), singleton bean, , , , , (.. singleton scoped beans) / - (.. ) .

Spring bean ?

Spring bean , , xml .

, , ( ) ? , , concurrency ( )?

, , , /, , , / , -, / .

- ?

- (, Tomcat ..) (, Spring DispatcherServlet ), , - (, Browser), url-pattern, web.xml .

+5

Source: https://habr.com/ru/post/1663925/


All Articles