@ControllerAdvice Improvements in Spring 4.0

spring

In my earlier article I have explained about the usage of @ControllerAdvice¬†which is introduced from the Spring 3.2 release. It is special type of @Component to declare the global exceptions handler. When you create a class with @ControllerAdvice and then write few methods with the @ExceptionHandler annotations, any exception thrown in the application will be […]

Spring 4.0 Environment Setup

spring

This tutorial explains how to setup your environment for working with the Spring 4.0 examples. Instead of explaining this process in every article, I would write it here so that this tutorial will be linked from the all Spring 4.0 tutorials for the setup reference. Spring 4.0 Maven Dependency At this time of writing this […]

RestController in Spring 4.0

spring-thumbnail

We are curiously waiting for the release of Spring 4.0 (Update : Spring 4.0 Released). This new version comes up with lot of exciting new features. One of the API improvements is new @RestController annotation which is inherited from the @Controller annotation. Prior to the version 4.0, all the Spring MVC components has to use […]

Spring 3 and JSR-330 Annotation : @Named and @Component Difference

spring

@Named and @Component annotations are used for the same purpose. Both the annotations are used for enabling a class to be auto detected as the bean definition for spring’s application context. The following are the main different of these two annotations. @Named is part of the. Java specification. It is more recommended since this annotation […]

Spring Bean Factory Exception : BeanFactory not initialized or already closed

spring

The given exception is exception is thrown when the spring bean factory is not initialized properly before it is used in your application. It normally occurs when we are not added the bean factory initialization code in our project. One typical example is adding the spring initialization parameter to web.xml deployment descriptor. Exception Trace:

Jersey : The ResourceConfig instance does not contain any root resource classes

java

When you are working with Jersey REST web services, you would encounter the following exception. This is occurred either of two reasons. com.sun.jersey.config.property.packages doesn’t exist in your web.xml. com.sun.jersey.config.property.packages included a package path, but that is not included any jersey services. If you check the above two reasons and resolve it, the below exception will […]

java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor

java

When you work on Hibernate, Jersey or any third party API, most of these APIs have the dependency with the asm.jar file. ASM is an all purpose Java bytecode manipulation and analysis framework. This is a common framework used by many of the thrird part frameworks internally, that is the reason many projects have this […]

Spring and Jersey Integration Example

spring

This tutorial explains how to write a simple example using Spring and Jersey. This example uses Jersey for the REST implementation, Spring is used for managing the beans. In my previous tutorial, I have explained how to write a simple REST application using Jersey. We also can use Spring alone for implementing the RESTful web […]

RESTful Web Service using Jersey

rest-thumbnail

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?

eclipse-thumbnail

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 […]