Welcome to my blog! I am a software engineer who likes writing about programming and everything related.
Demystifying Dependency Injection - What It Is and Why It Matters
This article is part of a series that goes in depth on Dependency Injection (DI). In this series, we learn what DI actually is and why we would want to use it. Once you start digging into it, you will encounter quite a few related terms, which will be explained. There are also multiple ways to inject dependencies, with even more names and smaller variations. We will cover those and also explore the different ways dependencies can be wired and which frameworks can help us do that. ...
Documentation as Code with AsciiDoctor, GitLab CI, and GitLab Pages
As a developer, I appreciate good documentation, but writing it myself is often cumbersome and feels unrewarding â especially when no one reads or uses it. The reason: documentation spread across multiple tools, with no clear way to find it. The solution is to use Documentation as Code. In projects where you are already using GitLab, you can write your documentation alongside your code in AsciiDoc, generate it as HTML using AsciiDoctor in GitLab CI, and publish it to GitLab Pages for everyone to read. ...
Using Sieve to Filter Emails with Zip Attachments
Luckily the emails were easy to spot and also quite similar, which made it easy to create a custom filter for them. They did not mention my name, the subject always contained the word âInvoiceâ and a zip file was attached. Writing a filter for the first two criteria was, but I wanted it to be thorough and also filter out emails with zip file attachments. My email provider uses Sieve to let the user define filters. However, it was quite difficult to learn how to define more specific rules that are not as simple as âcheck the subject if it contains the word invoiceâ. ...
Artikel "Lokales Testen von AWS Serverless Lambda-Funktionen" in der Java Aktuell 03-2023
Mein Artikel ist in der neusten Ausgabe der Zeitschrift Java Aktuell zu finden. Hier ist eine kurze Zusammenfassung des Inhalts: Das Testen von Microservices wird mittlerweile hinreichend praktiziert. Bei Serverless Functions wie AWS-Lambdas wird meist nur manuell nach einem Deployment getestet, speziell wenn es um die Logik geht, die durch AWS (Amazon Web Services) bereitgestellt wird. Dabei ist es auch möglich, die Anwendung automatisiert lokal hochzufahren und zu testen. Aber wie geht das in einem (relativ) geschlossenen System wie der AWS-Cloud? Durch den geschickten Einsatz von LocalStack, Testcontainers und dem AWS-SDK ist es unter anderem möglich, Component-Tests automatisiert auszufĂŒhren und etwaige Fehler in der Benutzung der Lambda-Funktion aufzudecken. ...
Recording and Slides of My Talk "Local testing of AWS serverless lambda functions" at an OpenValue Meetup
I really enjoyed the evening and the opportunity to speak at the meetup from OpenValue, thank you very much. Special thanks to Sebastian Konieczek for organizing the meetups. Abstract There are a lot of resources and best practices about testing of microservices. Serverless functions like AWS Lambdas are still mostly tested manually after a deployment, especially concerning logic provided by AWS. Though it is possible to start the application locally and even test it. But how does it work for a (relatively) closed system like the AWS cloud? Through smart usage of LocalStack, TestContainers and the AWS SDK it is possible to automatically execute component tests and uncover possible errors in the usage of the lambda function. ...
Accepted as a JavaLand newcomer speaker
Even with some experiences in microservices, switching into a cloud project was not easy all the time. The first time I started to test my implementations I struggled a lot, especially while dealing with AWS lambdas. There is not much information out there about it and a lot of things you might find are plain wrong or not functional at all. That is why the talk will deal with the local testing of AWS serverless lambdas. In the end I hope to make lots of developerâs life easier by providing a useful resource about testing. ...
Enable logging in Traefik
The examples can be executed locally which allows simple adjustment to your own needs. Technologies used are only docker and docker-compose. For the purpose of simpler declaration I will not make use of configuration files, but only use docker labels. Letâs get started with the deeper settings Traefik provides and then get into the general log and the access log. Settings for both logs There are different settings both logs share. Getting to know them is crucial when investigating problems with your settings. You might want to adjust them temporarily for debugging purposes. ...
Receiving mails in Java with IMAP or POP3
This example shows you how to receive mails in Java either using the IMAP or the POP3 protocol. The SSL encrypted variants IMAPS and POP3S are also supported. Received mails will be set to read, which means that you will only receive the latest ones. I will also give some hints about how to handle incoming mails concerning application security. Remember that you should always sanitize user inputs. Receiving mails You need to use to the following import statement import javax.mail.*; to be able to connect mail servers. The constructor of the client is straightforward. It is simply used to pass and store some values into fields, which are then used later on. We are interested in the protocol, host, port user and password. Valid values for the protocol are imap, imaps, pop3 and pop3s. ...
Redirecting to an external domain with Traefik
In this article I will show you how to use redirects to an external domain in Traefik. The example can be executed locally which allows simple adjustment to your own needs. Technologies used are only docker and docker-compose. For the purpose of simpler declaration I will not make use of configuration files, but only use docker labels. Traefik configuration A minimalistic configuration of Traefik can be seen in the code block below. Only port 80 is exposed end assigned to the web entrypoint. All incoming traffic is now routed through this specific entrypoint. ...
Fixing permissions of files in ssh folder
Permissions 0644 for '/home/<user>/.ssh/id_rsa' are too open. Windows obviously does not set the proper access rights to the files when copying them. Following an article from stackoverflow I simply set the access rights of all the files in the .ssh folder to 600. This solves the issue but is actually not better, because each file has itâs own permission for a reason. Some files are read only for security reasons, some are even changed by your ssh client and need a different permission due to that. ...