Create Date in Excel File using Apache POI in Java

Introduction In this example I will show you how to create date and put it in an excel file using Apache POI in Java language. I will show you how to build the project using both maven and gradle build tools. I will also show you how to create date using Java 8 or prior to Java 8 on java.util.Date…

Create excel file using Apache POI in Java

With this example we will show you how to create an excel file using Apache POI in Java language. The Apache POI is to create and maintain Java APIs for manipulating various file formats based upon the Office Open XML standards (OOXML) and Microsoft’s OLE 2 Compound Document format (OLE2). You can read and write MS Excel files using Java….

Conversion of Joda Date Time to SQL Timestamp and Vice Versa

Introduction This tutorial shows how you can convert joda date time to SQL timestamp or vice versa. Java’s standard date and time classes (mainly java.util.Date and java.util.Calendar) have limited functionality and have a number of design problems. The fact that many of constructors and methods of java.util.Date are deprecated. Joda Time has a better thought out API than what is…

Usage of Joda Date Time API

This tutorial shows how we can use joda date time API. Java’s standard date and time classes (mainly java.util.Date and java.util.Calendar) have limited functionality and have a number of design problems. The fact that many of constructors and methods of java.util.Date are deprecated. Joda Time has a better thought out API than what is available in Java’s date and time…

Convert List, Map to JSON in REST Response using Jersey

Introduction In this post we will see how to convert List, Map to JSON in REST Response using Jersey API. We will create three separate REST methods to convert List to JSOn, Map to JSON and List of Map to JSON string. We will annotate the REST resource class with @Path for having the base URI of the REST resources….

How to concurrently execute tasks using Java in Spring

This tutorials will show you how we can concurrently execute different operations using Java utility class called java.util.concurrent.Executors in Spring framework. Spring supports XML as well as Programmatic configuration of beans but, here we will use XML based metadata configuration. If you already have an idea on how to create a maven project in Eclipse will be great otherwise I…

Compound Property Names in Spring

With this example I will show you how compound or nested property names work in Spring application. Compound or nested property names are perfectly legal when setting bean properties, as long as all components of the path except the final property name are non-null. You can use compound or nested property names when you set bean properties, as long as…

Working with Collection Element Props in Spring Application

With this example I will show you how to inject Collections type Props in Spring applications. This is similar to the element type Map I had shown in another example. I am going to use Spring Boot framework but I will show you both using application.properties file as well as traditional XML config file to configure the props elements. In…

Comparator interface in Java

We will see what is comparator interface and how to use comparator interface in Java programming language. For more information please go through http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html A comparison function, which imposes a total ordering on some collection of objects. Comparator can be passed to a sort method (such as Collections.sort() or Arrays.sort()) to allow precise control over the sort order. Comparator can…

Comparable interface in Java

For more information please go through http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html This interface imposes a natural ordering on objects of each class that implements it and the class’s compareTo method is referred to as its natural comparison method. Lists or arrays of objects that implement this interface can be sorted automatically by Collections.sort or Arrays.sort respectively. Objects that implement this interface can be used…