I would like to just take a moment to express my love for Spring JDBC. I just deleted giant swaths of database connection handling code from an app I’m maintaining by replacing a DAO with a Spring JDBC version. If you haven’t taken the time to learn about it, check it out here.
Category Archives: spring
Managing ehcache through Spring
There does not appear to be any documentation in the Spring manual about setting up an ehcache cache in your Spring container. There is a Spring bean built in to do it. To set it up with the default configuration, all that is needed is a line like this:
<bean id=”mediaCache” class=”org.springframework.cache.ehcache.EhCacheFactoryBean”/>
It looks like you can also customize quite a bit of the config without providing an ehcache.xml file. That could be nice so you don’t have to go chasing around to find all of the settings.
The modern Java web app
I’m always looking for ways to streamline Java web app development. In case I haven’t spread the word to you, here’s the current set of technologies I’m liking:
- Tapestry 5 – This is the framework I’m using, but I’m not saying it’s better than anything in particular, but I like some of the stuff they are doing.
- Hibernate with annotations – I’ve been a big fan of hibernate for a long time, using the annotations seems to simplify the mapping process quite a bit.
- Spring Hibernate integration – makes transaction/error handling way way easier in Hibernate. I am using HibernateDaoSupport as a base class. Tapestry 5 also has Spring integration, allowing you to inject the DAO’s right into your page classes
- Maven 2 – So much easier than ant and dependency hell, once you get used to the paradigm shift. It might cause issues with your Eclipse tomcat integration, but I always found that to be flaky anyway. Use Jetty instead.
- Maven Jetty plugin – Allows you to build/deploy your app with one command (mvn clean jetty:run). Much easier than dealing with some of the flakiness of tomcat deployment, and allows you to just run one of your apps at a time.
I am also looking into Spring Security, and hoping it will simplify authorization, and I’m doing some IDE evaluations to see if it’s time to ditch Eclipse.