O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

Firstly, com.packt.boot_db_demo.PersonMapper annotated with org.apache.ibatis.annotations.Mapper knows how to execute the query provided within the @Select, @Update, or @Delete annotations and to return relevant results. This is all managed by the MyBatis and Spring Data libraries. 

You must be wondering how the connection to database was achieved. One of the Spring Boot autoconfiguration classes, DataSourceAutoConfiguration, does the work of setting up by making use of the spring.datasource.* properties defined in your application.properties file to give us an instance of javax.sql.DataSource. This javax.sql.DataSource object is then used by the MyBatis library to provide you with an instance of SqlSessionTemplate, which ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required