1,新建一java web工程:springWebTest.

2,加入spring2.5包(2.5以后版本方能注释注入)

3,新建两个java bean,Room.java和House.java,如下:

4,修改applicationContext.xml文件,如下:

5,新建SpringLoader.java类,它的init方法对spring工厂进行初始化,Service方法进行测试。

6,修改web.xml文件。

7,发布工程到tomcat,通过访问SpringLoader的service方法,即可看到spring的作用。

 

相关文章:

  • 2022-01-07
  • 2022-01-25
  • 2021-06-09
  • 2022-03-09
  • 2022-01-12
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
相关资源
相似解决方案