Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6767723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:59:07+00:00 2026-05-26T14:59:07+00:00

Spring beans have 2 types of scopes (if you do not take into account

  • 0

Spring beans have 2 types of scopes (if you do not take into account scopes for web): singleton, which is default and prototype. Roughly they implement singleton and prototype design patterns within context.

So if the bean has prototype scope it can hold a unique state like the stateful bean in EJB. When the scope of the bean is singleton the container will create only one instance of it. So we can say that singleton beans in EJB 3.1 is the analogue of singleton beans in spring.

But how I can get the features of stateless beans in Spring (I’m referring to pooling of stateless beans in EJB containers and about that each thread has a unique instance of the stateless bean)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:59:08+00:00Added an answer on May 26, 2026 at 2:59 pm

    Either you can make the bean thread-safe, and a singleton bean is OK (that’s the majority of the cases).

    Or you can’t, and you’ll have to use a prototype. The difference I see between Spring prototype beans and stateless EJB session beans is that stateless session beans are pooled. But in these ages, pooling them or creating a new instance each time won’t make much difference. Creating a new instance each time might even help the GC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a JSF web application. I use Beans as Spring Beans (not JSF
I have two spring beans as follows: @Component(A) @Scope(prototype) public class A extends TimerTask
I am using spring to initialise my beans. I have configured a bean which
i have a problem with spring autowire feature which found two beans with the
I have a Restful web service developed in Spring MVC which currently returns farmer
I have many cookie-cutter spring beans and don't want to explicitly define each one
I have two beans, beanA and beanB , in my Spring config. Both of
Please consider the following: we have a Spring bean B which is advised with
I have two CFC's which are Beans with DAO functions. I have set up
I have a queue into which multiple messages, all independent and which can be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.