servlet中注入spring托管bean的方法(二)

2014-11-24 02:38:38 · 作者: · 浏览: 1
ic void init() throws ServletException {

62

63 super.init();

64

65 }

66

67

68

69 @Override

70

71 public void service(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)

72

73 throws ServletException, IOException, RuntimeException {

74

75 ....

76

77 ....

78

79 userService.getUserByCode();(注入后bean的使用)

80

81 ....

82

83 ....

84

85 }

86

87 }

三、业务serlvet配置为spring的bean:

四、web.xml中业务servlet的配置:

view sourceprint 01

02

03 UserCheckProxy

04

05 com.XXX.xxxx.web.HttpServletProxy

06

07

08

09 targetServlet

10

11 userCheckServlet(业务servlet配置为spring的bean时的名字)

12

13

14

15

16

17

18

19 UserCheckProxy

20

21 /UserCheck

22

23

作者“lwei的博客”