DSL based approach to input Graph data in graph theory based java programs
Most of us have coded some programs which deal with graph theory algorithms like finding the shortest path between two vertices, finding the minimum spanning tree for a given graph and so on. In each...
View ArticleDeep dive into Optional class API in Java 8
We all as Java programmers been through the situation where in we invoke a method to get some value and then instead of directly invoking some methods on the return value, we first have to check that...
View ArticleDouble Brace Initialization Idiom and its drawbacks
This post is inspired by the Double Brace Initialization concept explained here. This technique can be used for creating and initializing objects and represent these operations in a single expression....
View ArticleCreating Websockets in JavaEE 7
I recently wrote about the WebSocket support in the latest JavaEE release i.e JavaEE 7. In the post I show how to create a WebSocket server end point and deploy it in Glassfish server and then connect...
View ArticleJSON Processing support in JavaEE 7 and JSR-353
JSON processing is not supported out of the box in Java. One would have to make use of 3rd part libraries to enable JSON processing. But with JSR 353 and its reference implementation JSON processing is...
View ArticleAnother sample for using JAXB
Recently I blogged a sample for using JAXB and thought of sharing it on my blog. The sample for JAXB can be found here. No related posts.
View ArticleGetting started with Mocking in Java using Mockito
We all write unit tests but the challenge we face at times is that the unit under test might be dependent on other components. And configuring other components for unit testing is definitely an...
View ArticleBook Review: Java Performance by Charlie Hunt and Binu John
If you want to: – learn about commands used for OS monitoring – understand about different components of JVM – monitor and tune JVM to improve its performance. then, Java Performance is the book you...
View ArticleSimple Aspect Oriented Programming (AOP) using CDI in JavaEE
We write service APIs which cater to certain business logic. There are few cross-cutting concerns that cover all service APIs like Security, Logging, Auditing, Measuring Latencies and so on. This is a...
View ArticleBook Review: Murach’s Java Servlets And JSP 3rd Edition
Murach’s Java Servlets and JSP is the ONLY book you need to learn Web App Development in Java using JSP and Servlets. The book covers all the concepts required you to build a complete Web application...
View ArticleUsing Google Guava Cache for local caching
Lot of times we would have to fetch the data from a database or another webservice or load it from file system. In cases where it involves a network call there would be inherent network latencies,...
View ArticleGetting rid of Getters and Setters in your POJO
We all have read in Java books about encapsulation of fields in Java class and also when ever you code you are asked to take special care in encapsulating the fields and providing explicit Getters and...
View ArticleNew @RequestParam annotations in Spring Boot 1.4 (Spring Framework 4.3)
Earlier in Spring/Spring Boot to Map a GET or POST or DELETE or any HTTP method request handler we would write something like below: @RestController @RequestMapping("/api/books") public class...
View ArticleGotcha: Migrating from Spring Security 3.2.x to Spring Security 4.x
Here is a simple gotcha to keep in mind while migrating to newer Spring Security version 4.x from Spring Security 3.2.x What’s the problem? The Spring security configuration expressions...
View ArticleBehavior Driven Development (BDD) of Postfix calculator
What is a postfix expression? An expression where in the operator is placed after the operands is called a postfix expression. For example an expression (also called infix expression) 2 + 3 in postfix...
View ArticleGetting to know about java.nio.file.Path – 1
Introduction The last few released of Java namely Java 7, Java 8 and the upcoming Java 9 have quite a lot of features which makes the life of Java developers easier. (I know Java 9 will make it...
View ArticleGetting to know about java.nio.file.Path – 2
In Part 1 of this, we looked at most of the APIs in the java.nio.file.Path class. In this article, we will look at the remaining APIs. Using register() This API allows us to register an implementation...
View ArticleUsing Gmail as SMTP server from Java, Spring Boot apps
Gmail users can use Gmail’s SMTP server smtp.gmail.com to send emails from their Spring Boot apps. For this let us do some setup in the app: Provide SMTP connection properties in the...
View ArticleMy First book Java 9 Cookbook, Packt Publications – Over 100 Java recipes...
Packt Publications recently published Java 9 Cookbook co-authored by me along with my co-author, a seasoned developer, Nick Samoylov. Yes!! This is my first publication and hopefully first of much...
View ArticleHow to Deploy Spring Application Without web.xml to Tomcat
Introduction Since the Servlet 3 specification web.xml is no longer needed for configuring your web application and has been replaced by using annotations. In this article, we will look at how to...
View Article