Tutorial

How to print current ClassLoader with or without Spring

Now we explain how to print a class loader associated to current thread. We can use Spring, and with one row of code, we solve the problem! We use the ClassLoaderUtils class.
For example:

System.out.println(
org.springframework.util.ClassLoaderUtils
    .showClassLoaderHierarchy(
Thread.currentThread().getContextClassLoader()));

If we don’t want to have any library dependency

Using dozer context mapping as factory bean

If you have a DTO (Data transfer object) or a VO (Value Object) and you want to mapping them
to a specific Pojo depending of a value of an attribute, you must to implement with a multiple if/else if
condition or instance of.
For example we have CarRaceVO with type attribute. If type have “F1″ value we instantiate
an […]

How to create a custom converter for copy properties

Now we would to introduce a short tutorial on how to create a custom converter for type String for the Common Beanutils Framework version 1.8.
If we would to copy the value of the propertry of an object, but for the Strings, we want to initialize to empty String the property when the original bean have […]

How to configure a composite foreign key in Hibernate (Tools) 3.0

The scenario of this tutorial is: we have a table with a foreign key, that reference to a composite primary key of another table. Probably a Legacy database scenario… These constraints are only logical defined. Suppose we have 2 tables. USERS and ORDERS with a one-to-many relationship. But USERS has a composite primary […]

How to build a breadcrumb with Spring Webflow 1.0.4

In this tutorial we explain how to create a simple breadcrumb with the new Spring Webflow framework, arrived at 1.0.4 version, released the 26 June 2007.
The first step is creating a class that implements FlowExecutionListener, a WebFlow framework library:
public class BreadcrumbListener implements FlowExecutionListener { }
Then, you can override one of the next two methods defined […]

How to load states attributes of a flow in Spring Webflow

Now you can read a mini tutorial on Spring Webflow. How to load a state attribute from a flow definition.
From the requestContext (of RequestContext class) we can load, for example, the current state.
StateDefinition currentState = requestContext.getCurrentState();
Now we can load an attribute, for example “caption”, defined in the following piece of xml flow definition file