@MockBean annotation is used to create and place mocks into Spring Application Contexts. If Spring Application Context does already have a bean of the same type then this bean will be replaced with a mock object. Otherwise, a new bean(mock) will be created and added to Spring Application Context.