Home » Author Archives: Biju Kunjummen (page 6)

Author Archives: Biju Kunjummen

Mixin in Java with Aspects – for a Scala traits sample

java-interview-questions-answers

Scala traits allow new behaviors to be mixed into a class. Consider two traits to add auditing and version related fields to JPA entities:                   package mvcsample.domain import javax.persistence.Version import scala.reflect.BeanProperty import java.util.Date trait Versionable { @Version @BeanProperty var version: Int = _ } trait Auditable { @BeanProperty var createdAt: Date = ...

Read More »

Spring Property Placeholder Configurer – A few not so obvious options

spring-interview-questions-answers

Spring’s PropertySourcesPlaceholderConfigurer is used for externalizing properties from the Spring bean definitions defined in XML or using Java Config. There are a few options that PlaceholderConfigurer supports that are not obvious from the documentation but are interesting and could be useful. To start with, an example from Spring’s documentation, consider a properties file with information to configure a datasource:   ...

Read More »

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 »
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