1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package
com.lavasoft.demo.web.controller.lsh.ch5;
import
org.springframework.context.annotation.Scope;
import
org.springframework.stereotype.Controller;
import
org.springframework.ui.ModelMap;
import
org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by Administrator on 14-4-9.
*
* @author leizhimin 14-4-9 上午10:55
*/
@Controller
@RequestMapping(
"/demo/lsh/ch5"
)
@Scope(
"prototype"
)
public
class
MultViewController {
private
static
int
st =
0
;
//静态的
private
int
index =
0
;
//非静态
@RequestMapping(
"/test"
)
public
String
test() {
System.out.println(st++ +
" | "
+ index++);
return
"/lsh/ch5/test"
;
}
}
|
4 | 0
改为单例的: