我在jsf <h:commandButton>调用的方法中有以下代码.
它获得了Spring的ApplicationContext,这意味着我可以使用它来获取bean.
FacesContext fc = FacesContext.getCurrentInstance();
ServletContext sc = (ServletContext) fc.getExternalContext().getContext();
ApplicationContext applicationContext = org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(sc);
Run Code Online (Sandbox Code Playgroud)
我的问题是如何获取正在运行的spring实例的ConfigurableApplicationContext.
我希望能够调用.stop .start和.refresh方法.
或者,如果有任何其他方式在正在运行的实例上调用它们,请通知我!
注意:应用程序中没有主要方法.它是部署在glassfish v2.1.1上的webApplication.