Spring JUnit Test not loading full Application Context
You need to annotate your test class with @ActiveProfiles
as follows; otherwise, your Application
configuration class will always be disabled. That's why you currently do not see any of your own beans listed in the ApplicationContext
.
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@ActiveProfiles(Constants.SPRING_PROFILE_DEVELOPMENT)
public class MongoDbRepositoryTest { /* ... */ }
In addition, Application
should be annotated with @Configuration
as was mentioned by someone else.