Home » Author Archives: Biju Kunjummen (page 5)

Author Archives: Biju Kunjummen

Spring Integration Standalone application with Spring Boot

spring-interview-questions-answers

I had earlier blogged about a way to write a standalone Spring Integration application. Spring Boot makes creating this standalone application much simpler. The simple flow was to poll the USGS service providing information about the earthquake activity around the world and to log this information. The flow described using Spring Integration is the following:           ...

Read More »

Consuming Spring-hateoas Rest service using Spring RestTemplate and Super type tokens

spring-interview-questions-answers

Spring-hateoas provides an excellent way for applications to create REST based services which follow the HATEOAS principle. My objective here is not to show how to create the service itself, but to demonstrate how to write a client to the service. The sample service that I am going to use is the ” the-spring-rest-stack” written by Josh Long( @starbuxman). The ...

Read More »

Spring Integration Publisher

spring-interview-questions-answers

Consider a hypothetical requirement – You have a service class in your application and you want to capture some information around the calls to this service:                   @Service public class SampleBean { private static final Logger logger = LoggerFactory.getLogger(SampleBean.class); public Response call(Request request) { logger.info("SampleBean.call invoked"); return new Response(true); } } AOP ...

Read More »

java.util.Random in Java 8

java-logo

One of the neat features of java.util.Random class in Java 8 is that it has been retrofitted to now return a random Stream of numbers. For eg, to generate an infinite stream of random doubles between 0(inclusive) and 1(exclusive):               Random random = new Random(); DoubleStream doubleStream = random.doubles(); or to generate an infinite ...

Read More »

Java 8 parameter name at runtime

java-logo

Java 8 will be introducing an easier way to discover the parameter names of methods and constructors. Prior to Java 8, the way to find the parameter names is by turning the debug symbols on at the compilation stage which adds meta information about the parameter names in the generated class files then to extract the information which is complicated ...

Read More »

Spring 4 Conditional

spring-interview-questions-answers

Spring 4 is introducing a new feature called Conditional – an annotation targeted towards Spring components which generate beans and vetos the generation of these beans, in essence it provides a way to conditionally generate beans. Consider a simple example: I have a service called “CustomerService”, with two implementations of this service, say “CustomerService1″ and “CustomerService2″. Based on the presence ...

Read More »

Reasons to consider spring-boot for your next Spring based application!

spring-interview-questions-answers

Spring-boot  provides a quick way to create a Spring based application. There are some very compelling reasons to consider spring-boot for your next project: Reason 1 : Simpler Dependency management using spring-boot starter projects. Consider the effort required to start up a CRUD web application using Spring-boot, assuming that the CRUD is implemented using a h2 database with Spring-Data providing ...

Read More »

Spring @Bean and PropertyPlaceHolderConfigurer

spring-interview-questions-answers

I was recently stumped by what I thought was going to be a fairly straightforward implementation – Consider the following Spring Java based bean definition file ( @Configuration):                 package root; ... @Configuration @PropertySource("classpath:root/test.props") public class SampleConfig { @Value("${test.prop}") private String attr; @Bean public SampleService sampleService() { return new SampleService(attr); } } Here ...

Read More »

Spring MVC Error handling flow

spring-interview-questions-answers

There are broadly three ways of handling an exception flow using Spring MVC, the objective being to intercept any application exception and present a friendly and informative view back to the user. 1. Using error-page tag in web.xml file: This is a servlet specs driven approach, where the exceptions that bubble up from the application are intercepted based on either ...

Read More »

Testing Spring “session” scope

spring-interview-questions-answers

In a Spring based Web application, beans can be scoped to the user “session”. This essentially means that state changes to the session scoped bean are only visible in the scope of the user session. The purpose of this entry is to simply highlight a way provided by Spring Test MVC to test components which have session scoped beans as ...

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