The situation of injecting container occurs when you try to wrap the container itself either in a singleton class or a public static method to provide the dependency to other components or modules, as in the following snippet:
public class AccountService { //Service method. public void getVariablePay() { System.out.println("getting variable pay.."); }}public class HRService { public int getLeaveInGivenMonth(int monthNo) { System.out.println(" getting no of leaves for month "+monthNo); return 2; // just for demo purpose. }}/* ServiceManager serves like dependency supplier */public class ServiceManager { private static ApplicationContext springContext = new ClassPathXmlApplicationContext("application-context.xml"); ...