To ensure Springboot framework rollback data, the transaction manager database requires needs to be controlled by a transaction managed by the Spring framework, in addition, the test class needs to add transaction comment.
Which @Transactional the annotation should be directly added to the class, @Rollback annotations can be added on in the class can also be applied to the method of rollback. Such a transaction would test controlled by spring, and rolled back by @Rollback to specify, for those who want the data off the library, then add @Commit comment on it
Reference material