Skip to content

Instantly share code, notes, and snippets.

@arganzheng
Created July 11, 2013 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arganzheng/5973610 to your computer and use it in GitHub Desktop.
Save arganzheng/5973610 to your computer and use it in GitHub Desktop.
可以使用这个ok.jsp检查应用是否正常启动
<%@page import="org.springframework.web.context.WebApplicationContext"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
<%@page import="org.springframework.web.context.support.XmlWebApplicationContext"%>
<%
XmlWebApplicationContext context = (XmlWebApplicationContext)WebApplicationContextUtils.getWebApplicationContext(application);
try{
if(!context.isActive()){
context.refresh();
}
out.write("ok");
}catch(Exception e){
out.write("failure");
throw e;
}
%>
@arganzheng
Copy link
Author

最好把IP地址也打出来:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment