get spring application context

Java
public class SpringBean {
  @Autowired
  private ApplicationContext appContext;
}
Source

Also in Java: