I propose you a simple solution based on Spring context, PropertyPlaceholderConfigurer to load and access to properties or parameters in all places of an application.

First, we have a properties’ file (for example) named “” in the server’s classpath (for example in the “etc” folder of TOMCAT server) containing:

# ################ ENVIRONMENT ##################

# ################ MAIL PARAMETERS ##################

Secondly, create a class containing a attribute for each parameter of above file. This class must used the “singleton” design pattern:

public class ConfigMyParameters {

	// ----------------------------------------------------- PRIVATE ATTRIBUTES
	 * Singleton instance
	private static ConfigMyParameters instance = null;

	 * Default mail domain
	private String defaultMailDomain = "";

	 * Contains the identity (email) used to send mails.
	private String smtpMailFrom = "";

	 * Smtp server host
	private String smtpMailhost = "";
	 * Smtp server port
	private String smtpMailport = "";
	 * Emails' list of administrators
	private List<String> mailAdministrators = new ArrayList<String>();

	// --------------------------------------------------------- PUBLIC METHODS
	 * @return an unique instance of the application configuration class.
	public static synchronized ConfigMyParameters getInstance() {
		if (null == instance) {
			String SPRING_FILE_NAME = "huo-spring-properties-config.xml";
			ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(SPRING_FILE_NAME);
			instance = (ConfigMyParameters) ctx.getBean("ConfigMyParameters");
		} // end-if
		return instance;
	// ------------------------------------------------------ GETTERS & SETTERS
         // ....

And lastly, we need to create a spring context in order to load the properties’ file “” with the singleton “”. In our example, this file is named “huo-spring-properties-config.xml” (cf the “” class.

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
	xsi:schemaLocation="    "

	 | Retrieve the common configuration datasource, constants,...
	<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">

	 | This bean is only used to determine in which environment this business is executed
	<bean id="ConfigMyParameters" class="huo.ConfigMyParameters">
		<property name="defaultMailDomain" value="${huo.config.mail.default.domain}" />

		 | SMTP Parameters 
		<property name="smtpMailhost" value="${}" />
		<property name="smtpMailport" value="${huo.config.smtp.port}" />
		<property name="smtpMailFrom" value="${huo.config.smtp.mailfrom}" />
		<property name="mailAdministrators" value="${huo.config.smtp.mailadministrators}" />

So, all application’s properties or parameters are accessible in all places of the application due to the “ConfigMyParameters” class.
Example: ConfigMyParameters.getInstance().getMailAdministratorsAsArray()

To add a new parameter, it is necessary to:

  • add a line in the file “” the form “KEY = VALUE”,
  • add a new private attribute in the class “ConfigMyParameters” with getter/setter,
  • change the Spring context file “huo-spring-properties-config.xml” to perform the mapping between the new parameter in properties’ file and class “ConfigMyParameters”.

Here, I want present you a powerfull command line tool for daily tasks named Swiss File Knife (SFK), which a lot of features:

  • Search text and binary files.
  • Filter and replace text in files.
  • Instant FTP and HTTP server, for easy file transfer between machines.
  • List directory tree sizes and files.
  • Zero installation, all-in-one executable.
  • Open source for Windows (9x/NT/XP/Vista/7), Linux and Mac.

SFK simply runs instantly, anywhere. SFK Base is free. SFK Extended Edition can also process .zip .jar .tar.gz and .tar.bz2 contents directly. To use this tool:

  • download the free swiss file knife base from sourceforge.
  • unpack the tool using winzip or unzip.
  • open the Windows Command Line or a Linux shell.

Personaly, I use SFK in order to search a specific class in a lot of jars files:

echo off 
sfk list -zip R:javadeveclipse_workspacesdefault-3.3myprojectlibs | find "DocumentController.class"

with for example the following results:


But SFK makes daily tasks easy a lot of others things: find and extract text in binary files, list dir tree sizes, filter and replace text, run an instant ftp server, http server for easy file transfer, find duplicate files, join many text files into one, create and verify md5 checksum lists, run a command on all files, detab text, create hexdumps from files, trace contents of a tcp connection, find dependencies between files, print colored text to terminal, locate commands in the path, print last lines of a file, convert CR/LF, hex to binary, binary to source code, split and join large files, list the contents of all .zip .jar .tar.gz and .tar.bz2 files…etc.


Often, developers forgotten the transactional behaviour of proxies Spring:
– by default, the transaction is rollbacked only in the case of runtime, unchecked exceptions (an instance or subclass of RuntimeException) and for Errors;
– the transaction is not rollbacked if a checked exception is thrown from a transactional method.

A good practice is to create 2 types of checked exceptions extending Exception:
– one for the rollback needs for example “BusinessMessageException extends Exception”,
– an other for the no-rollback needs for example “BusinessMessageExcWithoutRollback extends BusinessMessageException”,

and modify the transaction parameters of classes with

"@Transactional(readOnly = true, rollbackFor=BusinessMessageException.class)"

and depending on needs, the parameters of each transactional method with:

"@Transactional(readOnly = false, propagation = Propagation.REQUIRED, noRollbackFor=BusinessMessageExcWithoutRollback.class)"

After several information’s requests concerning the Spring certification, I have decided to write these some words about the SFC certification (Spring Framework Core) in order to share my resources and mock exams.

First, I have received during october 2008, the first training “Spring Framework Core” (4 days) at Luxembourg by the company Spring Source (Creators of the Spring framework). At the end of training, a voucher had been offered to allow the examination. Then, I took the exam SFC 2.5 during june 2011. This exam was about the version 2.5 of Spring, it had 50 multiple choice questions (one only possible answer per question), 88 minutes allotted for this exam. It is success when more than 75% of correct answers, and a provisional certificate of achievement is printed and delivered. The final certificate is received by email and/or post a few weeks later.

Concerning the registration and scheduling of exams, the candidates must register and schedule by:

  • Visiting the Pearsonvue website or Calling the Pearson VUE Call Center.
  • Spring exam should be scheduled at least one full business day in advance.
  • Candidates who need to cancel or reschedule their appointment must do so within 24 hours of their exam appointment.

For my preparation, I have studied Spring with:

For the mock exams, you could use the following resources which some are free and others by paying some euros:

To conclude this post, I propose you a ZIP bonus: a ZIP file containing the several mock exams with the corrections.

Best regards,

Page 52 of 54:« First« 49 50 51 52 53 54 »
Copyright ® 2012 Huseyin Ozveren. No reproduction, even partial, can be used from this site and all its contents including text, documents, images, etc.. without the express permission of the author.