Spring MVC 3.0.5+Spring 3.0.5+MyBatis3.0.4全注解实例详解(二)(二)

2014-11-24 01:00:29 · 作者: · 浏览: 1
找是否有与之匹配路径的处理方法,有则执行,没有就会输出一个Not Page Found警告信息。
\

展示层使用freemarker模板引擎,为了便于编辑,大象在这里使用html作为展示页。Spring框架对freemarker进行了集成与封装,配置起来非常简单。主要是定义FreeMarker视图解析器与属性配置,网上有很多关于这些属性含义的介绍,大象就不在这里 嗦了,后面讲到Spring MVC的时候会结合代码来进行说明。Spring MVC支持多种类型的视图文件。如:jsp、freemarker、velocity、tiles、jasperreports等。
\

4、service-context.xml
与ssh2里面的application.xml区别不大,主要是将hibernate那部分改为mybatis,还要将MybatisDao基类配置进来,以便Service类可以用注解的方式引入,然后就是扫描包路径,不扫描带有@Controller注解的类。因为这些类已经随容器启动时,在servlet-context中扫描过一遍了。
\

\

\

5、mybatis-config.xml
mybatis的主配置,里面包含了POJO的映射文件,这里了解一下就行,后面的章节会对这些进行说明,熟悉ibatis的朋友就很简单了,可以直接跳过。

<script type="text/java script">BAIDU_CLB_fillSlot("771048");
点击复制链接 与好友分享! 回本站首页
<script> function copyToClipBoard(){ var clipBoardContent=document.title + '\r\n' + document.location; clipBoardContent+='\r\n'; window.clipboardData.setData("Text",clipBoardContent); alert("恭喜您!复制成功"); }
分享到: 更多
<script type="text/java script" id="bdshare_js" data="type=tools&uid=12732"> <script type="text/java script" id="bdshell_js"> <script type="text/java script"> var bds_config = {'snsKey':{'tsina':'2386826374','tqq':'5e544a8fdea646c5a5f3967871346eb8'}}; document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js cdnversion=" + Math.ceil(new Date()/3600000)