The main role mapper-spring-boot-starter is

Today is the first exposure to this scene is really a starter in the heart of loss, learning for so long I actually do not know about the existence of good information today Look up

References ( https://blog.csdn.net/crq1205/article/details/88040582 )

MyBatis-Spring-Boot-Starter dependence will provide the following

1. a conventional automatic detection DataSource
2. SqlSessionFactory will create and register instances of this example using the DataSource as input SqlSessionFactoryBean transmission
3. create and register instances SqlSessionTemplate acquired from the SqlSessionFactory.
4. automatically scan your mappers, link them to SqlSessionTemplate and registering Spring context, in order to inject them into your bean.
5. After the use of the Starter, only need to define a DataSource can (or can be configured application.properties application.yml in), it is automatically created using the DataSource SqlSessionFactoryBean and SqlSessionTemplate. Automatically scans your Mappers, connected to SqlSessionTemplate, and registered with the Spring context.

src\main\resources\application.yml


Personally feel that we currently use springboot Quick Start tool seems to have for its packaging should be allowed to be a special statement, after I verified this guess is wrong, the built-in @mapper comment

Still need to write the sql statement. But this has been the most basic definition of sql statement, so the functionality is very similar with jpa. to be continued

Guess you like

Origin www.cnblogs.com/zhulina-917/p/11028339.html