java – Spring服务的默认范围

前端之家收集整理的这篇文章主要介绍了java – Spring服务的默认范围前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
哪个是 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

原文链接:https://www.f2er.com/java/124595.html

猜你在找的Java相关文章