Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
47d77252
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
47d77252
编写于
6月 07, 2016
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Document web scope annotations in the reference manual
Issue: SPR-13994
上级
6804aad0
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
6 deletion
+49
-6
src/asciidoc/core-beans.adoc
src/asciidoc/core-beans.adoc
+43
-4
src/asciidoc/whats-new.adoc
src/asciidoc/whats-new.adoc
+6
-2
未找到文件。
src/asciidoc/core-beans.adoc
浏览文件 @
47d77252
...
...
@@ -2422,7 +2422,7 @@ runtime more than once, see <<beans-factory-method-injection>>
[[
beans
-
factory
-
scopes
-
other
]]
===
request
,
session
,
globalSession
,
application
,
and
webs
ocket
scopes
===
Request
,
session
,
global
session
,
application
,
and
WebS
ocket
scopes
The
`
request
`,
`
session
`,
`
globalSession
`,
`
application
`,
and
`
websocket
`
scopes
are
__only__
available
if
you
use
a
web
-
aware
Spring
`
ApplicationContext
`
implementation
...
...
@@ -2497,7 +2497,7 @@ down the call chain.
[[beans-factory-scopes-request]]
==== Request scope
Consider the following bean definition:
Consider the following
XML configuration for a
bean definition:
[source,xml,indent=0]
[subs="verbatim,quotes"]
...
...
@@ -2513,11 +2513,24 @@ created from the same `loginAction` bean definition will not see these changes i
they are particular to an individual request. When the request completes processing, the
bean that is scoped to the request is discarded.
When using Java Config, the `@RequestScope` annotation can be used to assign a component
to the `request` scope.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
@RequestScope
@Component
public class LoginAction {
// ...
}
----
[[beans-factory-scopes-session]]
==== Session scope
Consider the following bean definition:
Consider the following
XML configuration for a
bean definition:
[source,xml,indent=0]
[subs="verbatim,quotes"]
...
...
@@ -2535,6 +2548,19 @@ changes in state, because they are particular to an individual HTTP `Session`. W
HTTP `Session` is eventually discarded, the bean that is scoped to that particular HTTP
`Session` is also discarded.
When using Java Config, the `@SessionScope` annotation can be used to assign a component
to the `session` scope.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
@SessionScope
@Component
public class UserPreferences {
// ...
}
----
[[beans-factory-scopes-global-session]]
==== Global session scope
...
...
@@ -2562,7 +2588,7 @@ error is raised.
[[beans-factory-scopes-application]]
==== Application scope
Consider the following bean definition:
Consider the following
XML configuration for a
bean definition:
[source,xml,indent=0]
[subs="verbatim,quotes"]
...
...
@@ -2578,6 +2604,19 @@ differs in two important ways: It is a singleton per `ServletContext`, not per S
'
ApplicationContext
' (for which there may be several in any given web application),
and it is actually exposed and therefore visible as a `ServletContext` attribute.
When using Java Config, the `@ApplicationScope` annotation can be used to assign a
component to the `application` scope.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
@ApplicationScope
@Component
public class AppPreferences {
// ...
}
----
[[beans-factory-scopes-other-injection]]
==== Scoped beans as dependencies
...
...
src/asciidoc/whats-new.adoc
浏览文件 @
47d77252
...
...
@@ -674,8 +674,12 @@ Spring 4.3 also improves the caching abstraction as follows:
* Built-in support for <<mvc-ann-requestmapping-head-options,HTTP HEAD and HTTP OPTIONS>>.
* New `@GetMapping`, `@PostMapping`, `@PutMapping`, `@DeleteMapping`, and `@PatchMapping`
_composed annotations_ for `@RequestMapping`.
** See <<mvc-ann-requestmapping-composed>> for details.
* New `@RequestScope`, `@SessionScope`, and `@ApplicationScope` _composed annotations_ for web scopes.
** See <<mvc-ann-requestmapping-composed,Composed @RequestMapping Variants>> for details.
* New `@RequestScope`, `@SessionScope`, and `@ApplicationScope` _composed annotations_
for web scopes.
** See <<beans-factory-scopes-request,Request scope>>,
<<beans-factory-scopes-session,Session scope>>, and
<<beans-factory-scopes-application,Application scope>> for details.
* New `@RestControllerAdvice` annotation with combined `@ControllerAdvice` with `@ResponseBody` semantics.
* `@ResponseStatus` is now supported at the class level and inherited by all methods.
* New `@SessionAttribute` annotation for access to session attributes (see <<mvc-ann-sessionattrib-global, example>>).
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录