Sunday, October 2, 2016

Autowiring into filter in Spring application

If you are facing problems autowiring dependencies in your filter class in Spring application Use the following trick.




@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filter)
throws IOException, ServletException {
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
...
...
...
...
...
}

$ ( Currency Sign ) Missing in Excel POI

If you are writing to a cell and find that currency sign is missing this could be because of the following reason.

Setting cell style is not enough

CellStyle dollarStyle=workbook.createCellStyle();
DataFormat df = workbook.createDataFormat();

dollarStyle.setDataFormat((short)8);


You also need to set the cell style to NUMERIC

cell.setCellType(Cell.CELL_TYPE_NUMERIC);