Spring beans redefinition in unit test environment

前端 未结 13 1952
醉话见心
醉话见心 2020-12-07 11:13

We are using Spring for my application purposes, and Spring Testing framework for unit tests. We have a small problem though: the application code loads a Spring application

13条回答
  •  臣服心动
    2020-12-07 12:09

    You do not need to use any test contexts (doesn't matter is XML or Java based). Since Spring boot 1.4 there is available new annotation @MockBean which introduced native support for mocking and Spying of Spring Beans.

提交回复
热议问题