1:spring的xml的加载,有很多方式,详情查看:http://blog.csdn.net/snowjlz/article/details/8158560
使用ContextLoaderListener
从ServletContext取得web.xml中初始化的ApplicationContext
首先在web.xml中配置listener。
<context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:spring*application-context.xml");
注意classpath的*表示支持多个文件加载;
2:spring 的xml的文件配置:
这个文件放的都是一些需要spring帮我们注入的been,在这里需要注意的是如果不适用标签,就要在自己手动去set一些方法,加标签的话:就不要再去配置been,直接把带有标签的包扫描进来,还有不要忘了扫描驱动;
<context:component-scan base-package="带有标签的包"/>
<tx:annotation-driven transaction-manager="txManager"/>
如果在spring框架中用到其他的框架,请把它导入spring的xml中