Replace spring bean in one context with mock version from another context

后端 未结 3 1764
一生所求
一生所求 2020-12-30 09:36

I\'m writing an integration test where an application context xml is initialized during startup. There are several test methods in the test class which make use of a specifi

3条回答
  •  -上瘾入骨i
    2020-12-30 10:02

    You can :

    • use the Profile annotation if you have spring 3.1.
    • use the Primary annotation
    • use qualifiers
    • wire the bean yourself in the spring context

    and i'm sure there are even more options.

提交回复
热议问题