导入依赖
org.mybatis.spring.boot mybatis-spring-boot-starter2.1.3
配置信息
#定义别名包 mybatis.type-aliases-package=com.lixianhe.pojo #导入映射文件 mybatis.mapper-locations=classpath:/mappers/*.xml
编写接口,加注解@Mapper,有加入组件的功能
@Mapper
public interface BriefMapper {
Brief getText();
}
编写xml文件,相当于实现类
select * from hospital.brief;
在Service层使用,之前JdbcTemplate用实现类,现在直接配置接口
@Autowired private BriefMapper briefMapper;



