-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support @MockBean for a MyBatis mapper interface #475
Comments
Thank you very much, @dldiehl77 ! This is a side effect of the fix for spring-projects/spring-boot#20665 . @kazuki43zoo , Thanks in advance! |
Hello @dldiehl77 ! We have merged mybatis/spring#494 . |
I am using MyBatis Spring Boot Starter version 2.1.3. Ever since moving to Spring Boot 2.2.7 (I've also tried 2.2.8 and 2.3.1 with the same results), I've had a problem using the MockBean annotation to mock a MyBatis interface (e.g. DAO or Mapper).
I have a MyBatis interface annotated with both Mapper and Repository. When I try to use the Spring Boot MockBean annotation, the object that is injected into my Service classes and the object that is injected into my unit test class are not the same, making it so that I cannot use Mockito.verify (as an example of one issue this causes).
A complete description is on stackoverflow here: https://stackoverflow.com/questions/62409666/mockbean-and-mybatis-mapper-not-working-together-as-they-did-before-spring-boot
Including a demo of the issue here: github.com/dldiehl77/mybatis-issues/tree/master/so-62409666
The text was updated successfully, but these errors were encountered: