Spring TestContext can also provide ways to test methods and controllers that need login credentials, which many applications with Spring Security integration require. This recipe builds MockMvc to the ApplicationContext container secured by the Spring Security 4.x module.