SPRING CORE / CATATAN</>↗Spring Core21 Mar 2012
Bean scoping is how the bean is created and returned from the spring container to the bean requester. By default, the scope of all bean is singleton. The spring container will always return the same bean whenever this bean is required, for instance when in injected or call using the getBean() method from the application […]
SPRING CORE / CATATAN</>↗Spring Core13 Mar 2012
This example show you how to create a bean using factory method in Spring Framework. We will use a singleton as an example. An instance of a singleton can be obtained only from a factory method because a singleton will have a private constructor, so it will not be possible to create an instance of […]
SPRING CORE / CATATAN</>↗Spring Core12 Mar 2012
The following example demonstrate how we can inject a bean through their constructors. We will create a couple interfaces and classes for this purpose. First we will create the Singer interface and the Instrument interface. The Singer interface define a single method call sing() that will enable the implementation to sing a song. The second […]
JODA-TIME / CATATAN</>↗Joda-Time27 Feb 2012
This example demonstrate how to use the ISODateTimeFormat class to format the date time information in Joda-Time. package org.kodejava.joda; import org.joda.time.DateTime; import org.joda.time.format.ISODateTimeFormat; public class ISODateTimeFormatDemo { public static void main(String[] args) { DateTime dateTime = DateTime.now(); // Returns a basic formatter for a full date as four digit // year, two-digit month of year, […]
JODA-TIME / CATATAN</>↗Joda-Time27 Feb 2012
An instant in the datetime continuum specified as a number of milliseconds from 1970-01-01T00:00Z. Some classes that represent an instance in the Joda-Time library includes the Instant, DateTime, DateMidnight and MutableDateTime classes. package org.kodejava.joda; import org.joda.time.DateTime; import org.joda.time.Instant; public class InstantDemo { public static void main(String[] args) { // An instant in the datetime continuum […]
JODA-TIME / CATATAN</>↗Joda-Time27 Feb 2012
This example show you how to use the org.joda.time.Interval class in Joda-Time. A time interval represents a period of time between two instants. Intervals are inclusive of the start instant and exclusive of the end. The end instant is always greater than or equal to the start instant. package org.kodejava.joda; import org.joda.time.DateTime; import org.joda.time.Duration; import […]