The test fails, because SimpleJdbcInsert sends following statement to the database:
INSERT INTO persons (lastname) VALUES(?)
This statement uses the wrong column lastname from the other database: example2.
The example project uses Spring Boot 2.1.0
When you revert to Spring Boot 2.0.6, the code works.
I think the problem is caused by the way the MySQL JDBC driver 8.0.13 provides meta data has changed, compared to the driver 5.1.47.
I have tried to indiciate this in the test ColumNames, provided in the project.
The default value of property nullCatalogMeansCurrent has been changed in mysql-driver 5.x and 8.x. In 5.x, the default value is true, and in 8.x false, so in 5.x DatabaseMetaData.getTables will return tables exactly from 'example1', and in 8.x DatabaseMetaData.getTables will return tables not only from 'example1' but from all databases, that's why the SQL will be changed to 'INSERT INTO persons (lastname) VALUES (?)'.
Workaround, add nullCatalogMeansCurrent=true to conn url when using mysql-driver 8.x, all tests pass successfully.