用idea第一次接触springboot+mybatis+mysql的新小白,还望大神回复:
springboot+mybatis还需要向ssm框架那样配置SqlSessionFactory吗?
最好能把配置给我,谢谢
不需要了,在application,yml中配置就行了
#数据源
datasource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/xxx
username: root
password: 123
name: xxx
driver-class-name: com.mysql.jdbc.Driver
#mybatis
mybatis:
mapper-locations: classpath:mapper/*DAOMapper.xml
type-aliases-package: entity包路径
不需要了,直接配置database参数,然后设置mybatis的一些mapper位置就可以了
那多数据源时候,怎么指定是哪个数据源提供服务?