Spring-dashboard getting started

Overview:
Spring-dashboard provides real-time statistic and monitoring view of a spring-framework web application. It does so by hooking into Spring web flow and gathering statistic information.

Configuration:
1) Set org.springdashboard.logic.MonitoredDispatcherServlet to be the dispatch servlet of your web application by configuring it in the web.xml. Here is how the web.xml looks like in the example war:
…
<servlet>

<servlet-name>springdashboard</servlet-name>
<servlet-class>org.springdashboard.logic.MonitoredDispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>springdashboard</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
…

2) Configure the spring-dashboard beans in your spring application XML. Here is how the springdashboard-servlet.xml looks like in the example war:
…
<!– monitor bean – be sure to map this controller to a URL!! –>
<bean id=”webMonitorBean” class=”org.springdashboard.logic.WebMonitorBean”>
<!– how many history flows should the webMonitorBean keep in memory –>
<property name=”maxNumberOfFlows”>10
</bean>

<!– Monotir view controller – be sure to map this controller to a URL!! –>
<bean id=”monitorViewController” class=”org.springdashboard.web.MonitorViewController”>
<!– the JSP that will present the XML data- default here is monitor.jsp –>
<property name=”view”><value>monitor</value></property>
</bean>

<bean id=”MonitorDataController” class=”org.springdashboard.web.MonitorDataController”>
<property name=”webMonitorBean”>
<ref bean=”webMonitorBean”/>
</property>
<!– the JSP that will format the data to XML- default here is monitorData.jsp –>
<property name=”formeterJSP”><value>monitorData</value></property>

</bean>
…
3) Default JSP’s for formatting the statistic data into XML and parse and presenting this XML (using AJAX) can be found in /example/ war/WEB-INF/jsp/ folder in the release. If you do not want to implement your own JSP, make sure to put these JSPs with your application JSPs
4) To view the statistic data open the URL you mapped MonitorViewController to.

Leave a Reply