RESTful Web Service using Jersey


In this tutorial I am going to explain a very basic example using Jersey REST Services. Building webservices using the REST concept is popular because of its simple nature and light weight. We have already explained how to write REST services using the Spring MVC framework. Spring provides out of the box support for the […]

How to Attach JDK source with Eclipse IDE?


This tutorial explains about how to attach JDK source code to your working environment. When you want to look at particulat source code, we can use CTRL+Click on the class name to refer the source code. However, by default developer can not refer JDK’s core Java files. It is referenced as the class files and […]

Expected Exception Test in JUnit 4


In my previous article I have written down the sample code for Junit 4 testing using annotations. In this tutorial I would like to write about expected exception testing and Rules which is introduced from JUnit 4.7. JUnit 4 introduced the expected parameter, which makes a test succeed if and only if a certain exception is thrown. In […]

JUnit 4 Annotation Example


This tutorial explains the basic usage of JUnit 4 annotations. JUnit is the most popular Unit testing framework most widely used by the Java developers. After the release of Java 5.0 annotations, JUnit 4 has updated to support the annotation programming for the testing methods. Also it introduced @BeforeClass and @AfterClass methods which has to […]

Connect To MySQL With JDBC Driver


Here is an example to connect your JDBC code to MySQl database. You have to download mysql.jar for the JDBC driver class from here.   If you are not copying the mysql.jar file in the classpath, you will get the following error.

Bean Definition Inheritance in Spring


In my previous post I have explained how to inherit collection values from the parent bean. Spring offers out of the box support on inheritance for the bean definitions in the XML configuration file. You can define any number of beans and extend them by using the parent  attribute in the bean element. Child bean can […]

How to Merge Collections in Spring?


In my previous post I have explained about how to use collections in Spring. This tutorial explains how to merge collections or inherit the values from the parent bean. In some scenarios we need to define a bean as abstract using the abstract=true in the bean definition. It means that another bean definition will be […]

Spring Collections Example


This tutorial explains how to use the collections API with Spring configurations. Spring provides out of the box support for all the collections classes like List, Set, Map and Properties for injecting the objects. There is a corresponding elements in the spring configuration file to pass the values to the Java objects. This tutorial passes […]

Circular Dependency in Spring


This tutorial explains one of the basic mistake done by the spring developers while defining the spring beans. Spring will not allow Circular Dependency and will throw an exception (BeanCurrentlyInCreationException) at the time of loading the configuration files. Also it is not good practice to design your project to have the circular dependency. What is […]

Configure Quartz Scheduler Jobs using XML File


In this tutorial I would explain how to configure quartz scheduler using properties file and xml file. Properties file will be used for configuring the JobStore details and XML configuration path. XML will store the list of Job details and cron triggers. In my previous post I have explained how to setup quartz scheduler pro-grammatically. […]