Home » Author Archives: Biju Kunjummen (page 6)

Author Archives: Biju Kunjummen

Spring MVC – Customizing RequestMappingHandlerMapping

spring-interview-questions-answers

When Spring MVC is configured using <mvc:annotation-driven/> in an xml bean definition file, internally a component called RequestMappingHandlerMapping gets registered with Spring MVC. This component or in general a HandlerMapping component is responsible for routing request URI’s to handlers which are the controller methods annotated with @RequestMapping annotation.               There are two specific configurations ...

Read More »

JUnit test method ordering

junit-logo

Junit until version 4.10 uses the order of test methods in a test class as returned by the reflection API as the order of test method execution - Class.getMethods(). To quote the Javadoc of getMethods() api: The elements in the array returned are not sorted and are not in any particular order. thus the order of test method execution in ...

Read More »

Json deserialization with Jackson and Super type tokens

json-logo

Datatables is a jquery plugin to present tabular information – it can enhance a simple table or can use a AJAX based data and present the information in a tabular form. Datatables requires the data from the server to follow a specific JSON format for it to be displayed on screen. Consider the case where a list of Member entities ...

Read More »

Composing Java annotations

java-logo

The allowed attribute types of a Java annotations are deliberately very restrictive, however some clean composite annotation types are possible with the allowed types.                     Consider a sample annotation from the tutorial site: package annotation; @interface ClassPreamble { String author(); String[] reviewers(); } Here the author and reviewers are of String ...

Read More »

Polling an http end point using Spring Integration

spring-interview-questions-answers

It is a little non-intuitive if you want to write a flow with Spring Integration which polls an http end point and gathers some content from the http end point for further processing. Spring Integration provides a couple of ways for integrating with a HTTP endpoint – Http Outbound adapter – to send the messages to an http endpoint Http Outbound ...

Read More »

Method Parameter Names and Spring

spring-interview-questions-answers

Continuing on the previous blog entry about Constructor and method parameters and Java not retaining the parameter names at runtime – the previous entry was about constructor not retaining the parameter names and the implication of this for Contructor injections in Spring, here I will cover a few more scenarios where parameter names not being retained has implications with Spring: 1. ...

Read More »

Spring Constructor Injection and Argument names

spring-interview-questions-answers

At runtime, java classes do not retain the name of the constructor or method parameters, unless classes are compiled with debug options on. This has some interesting implications for Spring Constructor Injection. Consider the following simple class         package dbg; public class Person { private final String first; private final String last; private final Address address; public ...

Read More »

Spring Collection Merging

spring-interview-questions-answers

Spring collection merging is a feature that I first came across as an answer to a StackOverflow question It is a way of creating a base collection (list, set, map or properties) and modifying this base collection in other beans, best explained using an example –             Consider a Person class with a field holding ...

Read More »

Spring Testing Support and Context caching

spring-interview-questions-answers

Spring provides a comprehensive support for unit and integration testing – through annotations to load up a Spring application context, integrate with unit testing frameworks like JUnit and TestNG. Since loading up a large application context for every test takes time, Spring intelligently caches the application context for a test suite – typically when we execute tests for a project, ...

Read More »

Java Annotations – Retention

java-logo

Consider a Java annotation: public @interface AnAnnotaton { } A class with this annotation applied on it: @AnAnnotaton class AnAnnotatedClass{ } And a test which checks if this annotation is present on a class: import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import java.lang.annotation.Annotation; import org.junit.Test; public class AnAnnotationTest { @Test public void testAnAnnotation() throws Exception { AnAnnotatedClass anAnnotatedClass = new AnAnnotatedClass(); ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close