Search code examples
javaspringapplicationcontext

Is Application Context in Spring Framework user specific or application specific?


Is application context you load from .xml file is user specific level or application level, like context is once loaded for all the user? or every user has separate application context?

while using spring framework in java?


Solution

  • The context is application-wide, but individual beans can have narrower scopes.

    The most common scopes are

    • singleton (default: one per application)
    • prototype (a new bean is created each time one is requested)
    • request (one bean per HTTP request)
    • session (one bean per HTTP session)

    Obviously, the latter two types are user-specific beans.

    Reference: