Thursday, June 18, 2015

How to set development/test/production environment in spring project (XML)

In real life development, a project always need different sets of  configurations for development, system test and production environments. Most common variables in these different environments are database location or jms location. If the project uses spring and will not run in any container,...

Monday, June 15, 2015

Spring JMS with ActiveMQ – hello world example – receive message using annotation

Since spring 4.1, using spring jms  to receive message can even easier than before. Just add one annotation @JmsListener before any POJO’s method. In this article, a hello world example will show how easy it can be done. There are other ways to  receive message from ActiveMQ broker using Spring...

Sunday, June 14, 2015

Build a spring project into an executable standalone jar in maven

To create an executable standalone jar, which can be run by command  like java –jar myExecutable.jar, there are 2 conditions need to be fulfilled: Specify the entry main class in META-INFO/MANIFEST.MF file Include all dependences  in the final jar file The second condition is not needed...

Friday, June 12, 2015

Use Hibernate level two cache with ehcache – hello world example

No doubt that well designed second level cache will greatly increase persistence performance. Hibernate clearly define the usage of 2nd level cache, but leave the cache implementation to other cache providers.  In this article ehcache is used as the second level cache provider. 0. What you need JDK 1.7+ Spring 4.1.0.RELEASE Hibernate 4.3.4.Final 1. Configure maven pom<project xmlns="http://maven.apache.org/POM/4.0.0"...

Thursday, June 11, 2015

Ehcache Issue : Element <cache> does not allow attribute "maxEntriesLocalHeap"

When using Ehcache as Hibernate second level cache provider, You may face the org.xml.sax.SAXException like this: Caused by: org.xml.sax.SAXException: null:25: Element <cache> does not allow attribute "maxEntriesLocalHeap". Reason This is because in “maxEntriesLocalHeap” is used in ehcahe configuration...

Tuesday, June 9, 2015

Use JMX to monitor Hibernate 4.3 statistics (with Spring)

To find out hibernate cache’s performance, like cache hit/miss ratio, JMX can be convenient. Before Hibernate 4.3, there is a StatisticsService class can be used. But Hibernate 4.3 removed this class.  If the project also uses Spring framework, it can still be done.  The original solution...
Powered by Blogger.

About The Author

My Photo
Has been a senior software developer, project manager for 10+ years. Dedicate himself to Alcatel-Lucent and China Telecom for delivering software solutions.