Object updater pattern in Kotlin Updating data is one of the most frequent use-cases in applications. But it might also be a painful task which results in a bunch of ugly code. I recently stumbled over a typical update scenario in a Domain-Driven-Design (DDD) application. In the following, I want to show an elegant solution implemented in Kotlin (a Java […]
Encapsulated modules and clean tests with Spring’s @Configuration Usually we use Spring’s @Configuration to define some special beans. A classic example is the definition of a data source: 1234567 @Beanpublic DataSource dataSource() { DataSource dataSource = new DataSource(); dataSource.setUsername(username); // ... and so on ... return dataSource;} However, we can also use Spring’s @Configuration to build better modules which helps us to writer cleaner tests. Let’s go through an example. An example Let’s assume we have an application which uses domain […]
DDD with Kotlin I recently made my first steps with Kotlin. After exploring the language for a couple of weeks, I tried to translate one of my favorite architectural patterns from my Java background to the Kotlin world – Domain Driven Design. Example project I’ve prepared an example project on GitHub showing some of the most important concepts […]
Self-made event dispatcher In my current project, we are using an event-based architecture in order to communicate between systems. The events are implemented as JMS messages, which we send over an ActiveMQ broker. Each system sends and listens to multiple events. While sending events is pretty easy, on the listener side we quickly ended up with a class […]
Generating PDFs with Java, Flying Saucer and Thymeleaf (Part 2) Last year, I wrote an article about generating PDFs with Java and Flying Saucer using Thymeleaf HTML templates. The article covered all basic steps to generate a simple (text only) PDF file. However, I got some comments on how to include images or how to style the PDF. So let’s have a look at part […]
A component-based test architecture for Protractor and AngularJS E2E tests Usually, when we talk about architecture, we talk about the application itself. We think about layers, domain models and interfaces to structure our code. Most of the time the tests will follow this architecture. We create one test per service and mirror our code. 12 user-dashboard.service.jsuser-dashboard.service.spec.js This is fine for unit and even integration tests, but […]
Simple permission handling in AngularJS Despite of a simple authentication, a lot of applications have a concept of authorisation. An user is not only logged-in, but has a set of roles which allow him to perform certain actions or see certain views. For example an user with the role ADMIN will probably be able to do more things as an […]
Messages vs. Events vs. Commands In a distributed environment, services must communicate with each other. One of the most popular ways of communication is messaging. Tools like ActiveMQ, RabbitMQ or Kafka are making it easy to exchange messages between systems. But no matter which broker you are using, you must decide which kind of message you want to send. Messages […]
Saga pattern with Spring Boot and ActiveMQ During the last days, I dug a little bit into the Saga pattern. The Saga pattern is an architectural pattern which provides an alternative approach to big and long running ACID transactions. It takes a business process and breaks it up into small isolated steps – each of them with its own transaction. The overall […]
Spring-Boot boilerplate project with ActiveMQ and AngularJS During the last couple of months, I wrote a lot blog posts about ActiveMQ (JMS), AngularJS and Spring. Most of those blog posts include some small code snippets, but nothing more. That’s why I decided to setup a “boilerplate project” to show how all those different techniques can go hand in hand in a “real […]