Why Spring bean is singleton scope? -
I'm working with hibernate and spring. It's been good .. but I have some doubts < P> 1) Why is the spring scope singleton by default? Is there any reason for that? 2) Can I write the last variable in the hibernate unit? Example: Can I write as above? 3) Can the static varibles be searlizable? Stateless Beans Rule :) If you are not holding state data in beans, then only one of each bean Example is enough for you. You should also remember that this is not JVM singletons - just Spring Singlatan, therefore, you do not need to provide only personal constructors and any sense () methods. Excerpt from Spring Documents: When a bean is a singleton, only a shared bean instance will be managed and the id that matches the definition of bean or All beans with IDs will be requested that a specific Bean example is being returned. Only when you have to keep some details of the session that you should use for instance sessions. @Entity Public Class Emp {@ ID Private Long ID; Last private string pan; }
Comments
Post a Comment