Ensuring transaction safety when using the MySQL/JPA+Hibernate/Spring mix
When using JPA, using transactions is something one might take for granted. However, when you're using MySQL and you're not in control of the database, you may find yourself debugging a really hard bug: transactions that aren't properly rolled back.
Creating a custom binder for Spring RCP
Introduction
For those not familiar with RCP, a quick heads-up. Spring RCP is a Swing application framework, based on the Spring Framework. It utilizes many of Spring's available utilities, the Spring IOC container being the most important one.
Bindings and binders
Spring RCP gives you the possibility to create controls that are bound to certain properties of a given object. These bound controls are called bindings. A binder is a class that creates bindings. A binding factory, if you will.
Standard Spring RCP has some basic binders, but often you will encounter user requirements that require you to build a custom binder. For example, a binder to show a list of objects in a JTable, a binder to show a String in a formatted text field or even a binding to show and select an image. These are not standard in RCP, and you'll need to make those yourself.
Adding security to CXF web services
In my previous post, I demonstrated how easy it is to create REST services using Spring and CXF. Now I'll show you something even easier: adding security.
For this example, I'll start where I left off, which is a working REST service showing the time, and add basic HTTP authentication. I'll be using Spring Security 3 to add the security features. Spring Security 3 is relatively new and those used to version 2 will need a wee bit of adjustment (you'll need more jars, as they split them up).
Creating a REST service with CXF and Spring in 10 minutes
I love REST. It's easy, straightforward and above all: easily testable. When you're developing with REST, you have a lot of options to choose from. There's Jersey, the reference Sun implementation, then you have RestEasy, the JBoss choice, and there is CXF, the Apache choice. I chose CXF for this example simply because it's so easy to create REST services with it, without a lot of configuration.