Step 1: Let's say we have a AccountService class that we want to subject under test. While testing, we want to supply mocks for BankAccountService and CashTransactionService. But use the real CalcEngine.

Step 3: Now the Spring config class that overrides DI in AccountService with fully and partially mocked injection. The resource names need to be same to override, and nor defined under @ComponentScan but defined with @Bean.