Question: How can you access the application context in a Spring integration test?
- The context is present in a ThreadLocal so you can just call getSpringApplicationContextInstance() anywhere in a test to get the current context.
- Test classes can implement the ApplicationContextAware interface or autowire the ApplicationContext.
- The context is automatically injected in every test so you can just call getSpringApplicationContextInstance() anywhere in a test to get the current context.
- You can just add the parameter Context context to any method so that the context is automatically wired in.
Answer: The correct answer of the above question is Option B:Test classes can implement the ApplicationContextAware interface or autowire the ApplicationContext.