JSF & Java Blog

Discussion on Java and JSF, including Spring, Maven, Eclipse and Jenkins

Posts Categorized / Java

Guava ImmutableMap Spring bean

I previously had some maps defined as Spring beans in my applicationContext.xml file. An example of a basic Map is shown below: I wanted to make these all immutable and so Guava’s ImmutableMap seeemed the logical Map type to use. However, ImmutableMap is abstract so you can’t just do the following: Instead, thanks to help […]

0

Using Reflection to print out an object

This is really old news but I always forget which class to use when I need to provide a toString method that uses reflection to print out all the classes values ToStringBuilder.reflectionToString in the apache commons library gives this functionality. e.g. We are currently starting to use Guava as a Utility library and the class […]

0

Beware what you put in the endorsed dir!

We use docflex to build our XSD documentation, integrating with maven to produce XSD documentation in our maven site reports. I recently had to upgrade some developers from docflex-re 1.8.0 to 1.8.5, this migration went fine. For some reason it didn’t on my machine. I received the following error: Anyway to cut a long story […]

0

Useful Eclipse Plugins

A list of handy Eclipse plugins for the Eclipse IDE eCobertura – Allows Cobertura code coverage to be run from the IDE directly eclipse-cs – Enforces coding standards using the CheckStyle tool PMD – Scans Java code and reports potential problems M2Eclipse – Maven integration from Sonatype m2e-extensions – Works with version 0.10 of the […]

1

JSF, Iterating with tomahawk radio buttons, t:datalist, a4j:repeat

The standard JSF radio buttons h:selectOneRadio render a load of old school html (i.e. they use table tags to do layout, (all a bit 1996)). e.g. JSF h:selectOneRadio tag Code for #{radioOptions} Note: I’m using jboss seam in the example above, but you could easily remove the seam annotations and define the bean in using […]

0

Maven site generation error: DTDDVFactoryImpl does not extend from DTDDVFactory

When generating a site with Maven, we encountered the following exception when a particular reporting plugin was executed: This basically meant that an incompatible version of xerces was trying to be run. We have everything set to use Java 1.6, which ships with its own version of xerces. After some debugging, it was tracked down […]

5

Suppress logging in java unit tests

Here are a couple of different ways of suppressing logging when running unit tests. If you are using apache commons logging then you can suppress logging with the following code: If running your unit tests with JUnit, it is probably best to put this code in the setUp() method. However, if you only wanted it […]

0