Ideas:
SqlsessionFactory -> Sqlsession -> StudentMapper -> CRUD
- Import jar
- Prepare the test data (type - Table)
, such as: Student (stuno, name, age ) - Create and configure studentMapper.xml
- MyBatis configuration file
- Write StudentDaoImpl
- Create a profile db.properties
- Db.properties introduced in the spring configuration file
- Before configuring the database in MyBatis, the configure now in the spring
- Creating mybatis in springIOC in core classes sqlSessionFactoryBean, and mybatis configuration file is loaded into spring
- IOC created StudentMapper (before StudentDao) and StudentService, pay attention to the creation StudentMapper