Java

A Semantic Logger for JVM Languages

This little library is inspired by the talk Observability in einer Microservice Welt held on Berlin Expert Days 2018 by Andreas Weigel and Jakob Fels. If you prefer to have some semantic to your logging and improve code readability you can use the SemanticLogger and its SemanticLoggerFactory which adds a thin layer around Slf4j. The SemanticLoggerFactory can be used like the Slf4j LoggerFactory to create a new Logger by class, name or a delegateLogger:
Read more

Building a Spring Boot 2 Auto-Configuration and Starter with Kotlin and Gradle

A concept that makes Spring Boot very powerful are its Starters and Auto-Configuration. It enables the automatic inclusion of dependencies and configuration or initialization based on several conditions. Recently I have been looking for a tutorial or “best practice” on how to use Gradle to build a custom starter. Since I was unable to find an example I ended up writing my own. I also added some Kotlin into the mix.
Read more

[100 Days of Code] Day 060: June 14, 2017

Unfortunately I had some important things to manage in the last days and therefore have not been able to work a lot on my projects. However since I’m doing this challenge to motivate myself and to have constant progress in my project I will continue where I left off a few days ago. Today’s Progress: Managed to get Jenkins collect all test results. Still don’t know why the integration tests are flickering.
Read more

[100 Days of Code] Day 057: June 9, 2017

Today’s Progress: Published first snapshot version of a project to OSSRH maven repository. Things I’ve learned: How to setup an account with Sonatype and publish an artifact from a gradle build Things I’ve planned for tomorrow: Integrate publishing into CD pipeline. Link(s) to work: rule-jpa

[100 Days of Code] Day 056: June 7, 2017

Today’s Progress: I have been fighting with eclipse link the whole time. Suddenly my integration tests that where using JPA did stop working. Finally I decided to switch to Hibernate which solved my problems. Things I’ve learned: I will be using Hibernate from now on whenever possible. Things I’ve planned for tomorrow: Continue to publish the whole dependency chain so I can continue with my CD pipeline. Link(s) to work: rules-jpa

[100 Days of Code] Day 055: June 6, 2017

Today’s Progress: As I started to build my CD pipeline I noticed that I have some smaller “common” projects that have to be available in a repository in order to be used as a dependency during build. So I started to look into the different types of repositories that are available. Since my current project is publicly available I think that I also have to make the dependencies publicly available in a repository.
Read more

[100 Days of Code] Day 053: June 4, 2017

Today’s Progress: Implemented integration-tests for OAuth 2 token retrieval. Things I’ve learned: Learned many details about the different OAuth 2 grant_types and flows. This demonstrates how much you can learn when implementing tests ;) Things I’ve planned for tomorrow: Cleanup the tests and maybe implement some more API endpoints. Link(s) to work: security-server

Control following of redirects with Rest-Assured

By default Rest-Assured will follow a redirection if it receives a 302 response after issuing a request. In this case your checks will be applied to the response after the redirect. Some times you may not want this to happen and rather examine the response of the original request for example to extract cookies or assert the correct location of the redirect. To achieve this you can use the redirects().follow(false) directive when formulating the request:
Read more

[100 Days of Code] Day 052: June 3, 2017

Today’s Progress: F-I-N-A-L-L-Y got OAuth 2 and session/UI based authorization with Spring Security working. Things I’ve learned: A lot about Spring Security filters, and security configuration. Things I’ve planned for tomorrow: Improve the api of the server by adding some more features. Link(s) to work: security-server

[100 Days of Code] Day 051: June 3, 2017

By looking deeper into the inner mechanics of Spring Security and OAuth2 I started to get an idea where my problem arises. Basically I’m trying to combine a REST resource secured by an OAuth 2 generated token (implicit grant type) and a “general” web page protected by a login form and session based authentication mechanism. It seems as if all filters that are needed for the different authentication methods require a very special filter combination.
Read more