简体   繁体   中英

Regarding Instance in Spring mvc web application development

I am new to spring mvc web development. I have one query. Suppose we are having different service classes. So do we have one instance of those classes per request OR only single instance of that class gets create. Actually i want to use instance variables , so with each request new instance will get created or it will be like singleton type of behavior. Hopefully i am able to explain my question.

you can have either, the default is a singleton - one instance. But this can be changed using bean scope.

obligatory link to offical docs correct chapter

(personally never needed to use anything other singleton)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM