Spring RestTemplate

Client-Side HTTP Accessspringleaf

We have all been in the situation where we need to access a remote API, to return JSON or XML data.  We then have to take that data and transform it, via JSON object mappers or XML unmarshallers.

Continue reading

Posted in java, OAuth, OpenID, REST, Spring, Web | Leave a comment

AssertJ vs JUnit Assert

JUnit is a very popular test framework, which includes a package commonly referred to johnnyTestas assertions.  Assertions allow us to inspect variables in our test methods, to assert they either have been instantiated or have certain values.

This short blog post will discuss the AssertJ library and how it can help a developer to more intuitively assert their test functionality.

Continue reading

Posted in AspectJ, java, JUnit, Web | Leave a comment

Aspect Oriented Programming

As defined on many areas of the Internet, aspect oriented programming (AOP) helps internal_dividersmodularize functionality across multiple areas of your implementation.  Generally, that means you can define functionality in one location, and use it in multiple areas of your solution; without explicitly having to implement/use it where you need it.

In this post, I will define how we can use AOP to insert functionality across our entire implementation; namely, defining default logging across your solution, without needing to implement boilerplate code with every method.  Continue reading

Posted in AOP, java, REST, Spring, Web | Leave a comment

Jersey 2.x Filters

I have recently completed work on an HTTP request filter, and thought to share my jersey_logo
experiences with implementing and designing it. I will give a quick introduction to what filters are and finish with a small example of a filter implementation.

A filter is used to intercept request or Continue reading

Posted in java, Jersey, REST, Web | Tagged , , , | Leave a comment

Dropwizard and Spring Boot

spring_to_dropwizardI recently accepted a position as a developer in a shop that uses Dropwizard for wiring up REST APIs, using Google’s Guice as an IoC container.  You can read more on Inversion of Control here.  So I had to take a step back and understand what I was working with, relative to what I was accustomed to using. Continue reading

Posted in java, REST, Spring, Web | 1 Comment

Java Singleton Class Vs. Java Static Methods/Variables: Are They The Same?

Java LogoThe title has an important distinction. Note the Java programming language reference. Singleton classes and statically typed classes are implemented differently in various languages. But for the purposes of this blog post, I will discuss this topic in terms of the Java programming language.

If you Google this topic, you can find a lot of information on the answer to the question I ask in this blog entry. My motivations for blogging about this topic is two-fold: I get many engineers hesitant to implement it, other than not liking it, and it’s a design pattern that seems to come up a lot in interviews.

Professionals argue one side or the other, usually avoiding this pattern for incorrect reasons. First, lets discuss both approaches: Singleton Design Pattern and Static Methods/Variables.

Continue reading

Posted in Design Patterns | Tagged , , , , , , | Leave a comment

Reversing a Linked List

linked listA common interview challenge, for software engineers/developers, is to implement an algorithm to reverse a linked list. Although this is not very common in practice, it is a good way to infer your knowledge of linked lists and how to manipulate/view objects in memory.

We will reverse a linked list, both via recursion and iteration, or the iterative approach.
Continue reading

Posted in Algorithms | Tagged , , , , | 4 Comments