Category: Java

Testing a HATEOAS service

This post is a follow up post to a few that I have written recently relating to writing a HATEOAS service and handling exceptions with Spring (Applying HATEOAS to a REST API with Spring Boot and Global exception handling with @ControllerAdvice). Now that we have looked through setting up a service and how to add ...

Global exception handling with @ControllerAdvice

@ControllerAdvice is a annotation provided by Spring allowing you to write global code that can be applied to a wide range of controllers, varying from all controllers to a chosen package or even a specific annotation. In this brief tutorial we will focus on handling exceptions using @ControllerAdvice and @ExceptionHandler (@InitBinder and @ModalAttribute can also be used ...

Applying HATEOAS to a REST API with Spring Boot

HATEOAS is an acronym for Hypermedia As The Engine Of Application State. Even after expanding that for you it still might not mean a lot. HATEOAS is an extra level upon REST and is used to present information about the REST API to the client, allowing for a better understanding of the API without the ...

Configuring Logback with Spring Boot

Logback is provided out of the box with Spring Boot when you use one of the Spring Boot starter dependencies as they include spring-boot-starter-logging providing logging without any configuration and can be altered to work differently if required. There are two ways of providing your own configuration, if you only need simpler alterations they can ...

Default and private methods in Interfaces

In this tutorial we will look at default and private methods within interfaces. Default methods were added in Java 8 allowing methods to be added to an interface that comes with a default implementation that could be used, overridden or ignored without causing issues to existing classes that have implemented an interface. Private methods were ...

Playing around with Spring Bean Configuration

In this tutorial we will have a look at something more basic on the Spring spectrum, but as most things can sometimes be forgotten and is something that personally I have not looked at properly since switching from XML to Java configuration. The creation of beans is pretty important to the use of Spring (probably ...

Setting up a Oracle Cloud Account + using a confusing website is not fun

This post will diverge slightly from most of my normal tutorials as quite frankly I got pretty pissed off trying to set up an Oracle Cloud account to the point where I could actually deploy an application. I got so annoyed that I nearly gave up... after writing some tweets displaying my annoyance first of ...