I have a test class that looks like this : 

```
@SpringApplicationConfiguration(classes = RecipesApplicationTest.class) // This test class will configure its own context
@ComponentScan("com.mysmartfridge.domain.recipes") // Scan recipes domain package so that domain services are available
@Import(RecipesApplication.class) // Load the bean that we want to test.
public class RecipesApplicationTest {

    @ClassRule
    public static final SpringClassRule SCR = new SpringClassRule();

    @Rule
    public final SpringMethodRule SMR = new SpringMethodRule();

    @Autowired
    private RecipesRepository recipesRepository;

    private final RecipesRepository recipesRepositoryMock = Mockito.mock(RecipesRepository.class); // final mocks because they are given to spring context.

    // Get the service to test from the context
    @Autowired
    RecipesApplication recipesApplication;

    @Test
    public void addingARecipeShouldMakeItAvailableInRandomRecipes() {
        //given
        RecipeDto dto = new RecipeDto();
        dto.title="test";
        dto.ingredients = new ArrayList<>();
        dto.steps = new ArrayList<>();

        final List<Recipe> recipesInMock = new ArrayList<>();
        Mockito.when(recipesRepository.save(Mockito.any(Recipe.class))).thenAnswer(new Answer<Recipe>() {
            @Override
            public Recipe answer(InvocationOnMock aInvocation) throws Throwable {
                Recipe arg = aInvocation.getArgumentAt(0, Recipe.class);
                recipesInMock.add(arg);
                return arg;
            }
        });

        Mockito.when(recipesRepository.findAll()).thenAnswer(new Answer<List<Recipe>>() {
            @Override
            public List<Recipe> answer(InvocationOnMock aInvocation) throws Throwable {
                return recipesInMock;
            }
        });

        //when
        dto = recipesApplication.createRecipe(dto);
        RecipeDto randomDto = recipesApplication.findRandomRecipe();

        //then
        Assertions.assertThat(randomDto).isEqualTo(dto);
    }

    // Inject the recipeRepository mock in the context
    @Bean
    RecipesRepository recipesRepository() {
        return recipesRepositoryMock;
    }

}

```

My problem is that the two fields recipesRepositoryMock and recipesRepository are not the same object. Thus, if i try to replace recipesRepository with recipesRepositoryMock when setting up my answers (i.e. if I do `when(recipesRepositoryMock.save()).thenAnswer(...)`), it doesn't work, then custom answer is never called. 

I would like to be able to get rid of the @Autowired recipesRepository which is kind of a duplicate with recipesRepositoryMock...

Is it because of a proxy added by spring around my bean ?