Spring Bean Scopes

  • singleton (default)
    only one instance per Spring Container
  • prototype
    any number of instances
  • request
    scoped to an HTTP request (web-aware Spring ApplicationContext)
  • session
    scoped to an HTTP session (web-aware Spring ApplicationContext)
  • global-session
    scoped to a global HTTP session (web-aware Spring ApplicationContext)

<bean id=”helloWorld” class=”Hello” scope=”singleton”>

<bean id=”helloWorld” scope=”prototype”>


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s