加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – Spring服务的默认范围

发布时间:2020-12-14 16:40:40 所属栏目:Java 来源:网络整理
导读:哪个是 Spring 4 @Service的默认范围? 为了存储与当前记录的用户(根据当前HTTP会话)相关的某些信息,通过类属性(也可以使用最终的修饰符)来设计Service实现是合理的? 解决方法 Which is the default scope of a Spring 4 @Service? 默认范围是单例 It is re
哪个是 Spring 4 @Service的默认范围?

为了存储与当前记录的用户(根据当前HTTP会话)相关的某些信息,通过类属性(也可以使用最终的修饰符)来设计Service实现是合理的?

解决方法

Which is the default scope of a Spring 4 @Service?

默认范围是单例

It is reasonable to design a Service implementation in order to store some info,related to the current logged user (according to the current HTTP session)

是.在这种情况下,服务将必须有范围“会话”.见http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-factory-scopes-other

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读