Spring JMX sample configuration for Hibernate & Ehcache statistics


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  4. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  5. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  6.  
  7. <context:mbean-server />
  8.  
  9. <bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporter">
  10. <property name="beans">
  11. <map>
  12. <entry key="SpringBeans:name=hibernateStatisticsMBean"
  13. value-ref="hibernateStatisticsMBean" />
  14. <entry key="SpringBeans:name=ehCacheManagerMBean" value-ref="ehCacheManagerMBean" />
  15. </map>
  16. </property>
  17. </bean>
  18.  
  19. <bean name="hibernateStatisticsMBean" class="org.hibernate.jmx.StatisticsService">
  20. <property name="sessionFactory" ref="sessionFactory" />
  21. </bean>
  22.  
  23. <bean name="ehCacheManagerMBean"
  24. class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" />
  25.  
  26. </beans>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.