Skip to content

Commit 2aea087

Browse files
committed
update README.md
1 parent f41af7c commit 2aea087

File tree

1 file changed

+2
-2
lines changed
  • src/main/java/org/spring/examples/scope

1 file changed

+2
-2
lines changed

src/main/java/org/spring/examples/scope/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
## 注意事项
44
- 使用**@Scope("request")**来定义request Bean;
5-
-**Controller**中使用了request Bean时,**Controller**也应该使用**@Scope("request")**来标注该Controller是request作用域,这样Spring会为每个请求创建一个**User**实例;
6-
- 如果**Controller**未使用**@Scope("request")**标注,每次请求时Spring将只创建一个**User**实例,然后使用Proxy方式注入HttpServletRequest对象;
5+
-**Controller**中使用了request Bean时,**Controller**也应该使用**@Scope("request")**来标注该Controller,这样Spring会为每个请求创建一个**User**实例;
6+
- 如果**Controller**未使用**@Scope("request")**标注,每次请求时Spring将共享一个**User**实例,然后使用Proxy方式注入HttpServletRequest对象,如果是这样的话**User**不是线程安全的
77
- 使用request Bean必须在web.xml根据需要定义**RequestContextListener/RequestContextFilter**
88
```xml
99
<listener>

0 commit comments

Comments
 (0)