Spring beans redefinition in unit test environment

前端 未结 13 1786
醉话见心
醉话见心 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:11

    Perhaps you could use qualifiers for your beans? You would redefine the beans you want to mock up in a separate application context and label them with a qualifier "test". In your unit tests, when wiring your beans always specify the qualifier "test" to use the mock ups.

    0 讨论(0)
提交回复
热议问题