博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
20.SSM整合-全注解开发
阅读量:7075 次
发布时间:2019-06-28

本文共 671 字,大约阅读时间需要 2 分钟。

全注解开发

  1.将SpringMVC改为注解

    修改spring-mvc.xml

  2.将Spring改为注解

      将Service改为注解,完成Dao的注入

      将事务以注解方式织入到Service

        1.修改spring-tx.xml,只负责事务的开启     

1 
2
3
4
5
6 7
8

        2.在service中使用注解织入事务 

1 @Transactional     //声明式的事务管理2     public void add(Student student) {3         studentDao.insert(student);    4     }

 

  3.将Mybatis 改为注解(删除mapper文件)(一般Mybatis不使用注解)

  

1 public interface StudentDao {2     //一般 情况下,为了 性能考虑, mybatis是不进行 注解的 3     @Insert(value="insert into student (sname) values (#{sname})")4     void insert(Student student);5 }

 

转载于:https://www.cnblogs.com/xuzekun/p/7418044.html

你可能感兴趣的文章
Intersect, Except, Union, All and Any(3)
查看>>
JAVA数据结构之单链表操作简单实现
查看>>
hdu 1208+hdu 1619(记忆化搜索)
查看>>
监听控件禁用键盘上的指定键 兼容iE、Chrome、火狐
查看>>
c#操作word文档之简历导出
查看>>
flashfxp ssl连接ftp
查看>>
How to communicate with an NFC reader
查看>>
【eoe资源】如何让Android ListView的平滑滚动
查看>>
Sharepoint学习笔记—习题系列--70-573习题解析 -(Q22-Q24)
查看>>
ios block循环引用问题
查看>>
地图覆盖物
查看>>
项目中出现黄色感叹号 教你去掉Myeclipse的黄色感叹号
查看>>
python手记(9)
查看>>
hdu 2451 Simple Addition Expression(数位DP )成败在于细节
查看>>
在开机广播中启动服务
查看>>
poj1077
查看>>
算法优化:rgb向yuv的转化最优算法,快得让你吃惊!
查看>>
[Android开发常见问题-11] Unable to execute dex: Multiple dex files define 解决方法
查看>>
CF 332A Down the Hatch! 超级水题。。不过题目太长了
查看>>
Oracle—RMAN备份(一)
查看>>