These tool are used in work, hence here fimply wirte them for reference afterwards.
1. Use SLF4J instead of common-logging as log adapter
SLF4J is new generation of logging framework, that also write by Log4j author, most of open source project already migrate to SLF4J, seems RBP also have used. More information you can reference to: http://www.slf4j.org/
use SLF4J instead of common-logging or log4j as log adapter, and still use Log4j as log implementation, so no impact to our exist log configure, just need change the log initialization in Java:
Import 2 jars to project
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
Import 2 Class in Java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Initialize Log
private static final Logger logger = LoggerFactory.getLogger(WPCBatchConstants.BATCH_DEBUGGER);
That's all, the usage same as our exist, but we will gain some advantage, like:
- Unneeded log level detect
if (logger.isDebugEnabled()) { }
Above statement is not need, SLF4J will help us to do optimize.
- {} placeholders supported
logger.debug("This debug log used for {}.", "WPC Batch");
2. Dozer is a Java Bean to Java Bean mapper that recursively copies data from one object to another.
If destination object have the same field name as the source object, then will be auto mapped, even the mapped attributes are different data types, the Dozer mapping engine will automatically perform data type conversion. More information please refer to: http://dozer.sourceforge.net/documentation/about.html.
That will help us convert TO in different layer, like Java Bean to DTO for DAO used.