Mybatis基于注解的开发

把UserDao.xml移除,在dao接口的方法上使用@Select注解,并且指定Sql语句

同时需要在SqlMapConfig.xml中的mapper配置时,使用class属性置顶dao接口的全限定类名

明确:

我们在世纪开发中,都是越简练越好,所以都是采用不写dao实现类的方式

不管使用xml配置还是注解配置

但是Mybatis它时支持写dao实现类的

所有代码: https://github.com/scott-x/idea-project-java

results matching ""

    No results matching ""