<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Backendhance</title><link>https://backendhance.com/en/blog/</link><description>Recent content Backendhance</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>contact@backendhance.com (Marcus Held)</managingEditor><webMaster>contact@backendhance.com (Marcus Held)</webMaster><lastBuildDate>Wed, 20 Sep 2023 07:00:56 +0200</lastBuildDate><atom:link href="https://backendhance.com/en/blog/index.xml" rel="self" type="application/rss+xml"/><item><title>Your Java Application in Detail: Performance Analysis with JMX and JDK Mission Control</title><link>https://backendhance.com/en/blog/2023/jmx-introduction/</link><pubDate>Wed, 20 Sep 2023 07:00:56 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/jmx-introduction/</guid><description>When it comes to analyzing the performance or behavior of a Java application, Java Management Extensions (JMX) is a valuable tool. In this article, we will explore how you can utilize JMX to profile your application, particularly with the use of JDK Mission Control (JMC).
JMX: A Quick Overview JMX provides a simple and standardized method for monitoring and managing Java applications. With JMX, you can access various metrics and information about your JVM and even adjust real-time settings.</description></item><item><title>Spring Events: Decouple Your Application with @EventListener and ApplicationEvents</title><link>https://backendhance.com/en/blog/2023/spring-events/</link><pubDate>Wed, 13 Sep 2023 07:07:21 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/spring-events/</guid><description>If you&amp;rsquo;re already working with the Spring Framework, you&amp;rsquo;ve undoubtedly recognized its power and versatility. One of the valuable - yet often overlooked - features of Spring is its event-handling system. In this article, we&amp;rsquo;ll delve deeper into how you can configure events in the Spring Framework using @EventListener. Moreover, we&amp;rsquo;ll illustrate how these events can be paired with transactions and asynchronicity.
Why Events in the Spring Framework? Events are an integral component of the Spring Framework.</description></item><item><title>Spring's Assert Class: The Smart Way to Validate</title><link>https://backendhance.com/en/blog/2023/spring-assert/</link><pubDate>Wed, 06 Sep 2023 07:00:42 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/spring-assert/</guid><description>There are many ways to ensure your code does what it&amp;rsquo;s supposed to do. Java even has a built-in assert language feature for this very purpose. And then there&amp;rsquo;s Spring&amp;rsquo;s Assert class. But why should I use this? In this article, we delve deeply into the subject and explore the advantages of using this class for validating your data and arguments.
Why Use Assertions at All? Before diving into the details of the Spring Assert class, let&amp;rsquo;s briefly clarify the significance of assertions.</description></item><item><title>Open Session in View (OSIV) in Spring - Enable or Disable?</title><link>https://backendhance.com/en/blog/2023/open-session-in-view/</link><pubDate>Wed, 30 Aug 2023 07:01:19 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/open-session-in-view/</guid><description>If you are working with Spring Boot and Hibernate, you have undoubtedly come across the term &amp;ldquo;Open Session in View&amp;rdquo; (OSIV) or its corresponding property open-in-view. But what exactly does this option do, and how does it affect your interaction with the database? Should you enable or disable it? In this article, we delve deep into the topic and shed light on its functionality and differences compared to other approaches.</description></item><item><title>Spring MVC: How to Use a Custom Converter for Type Safety in Controllers</title><link>https://backendhance.com/en/blog/2023/spring-converter/</link><pubDate>Wed, 23 Aug 2023 07:02:32 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/spring-converter/</guid><description>Are your controllers constantly filled with primitives? In ArticleController, the first line of every method is: articleRepository.findById(articleId). We keep making the same conversions. I hardly observe as many primitives in any other layer as in the API layer. This leads to much boilerplate. The code becomes harder to test. And it&amp;rsquo;s harder to read. Yet we know how much easier it is when we work with type safety. In this article, I will show you how to use the Converter Interface to automatically convert your primitives into the correct type.</description></item><item><title>Avoiding Static Access to SecurityContext with @AuthenticationPrincipal in Spring</title><link>https://backendhance.com/en/blog/2023/authentication-principal/</link><pubDate>Wed, 16 Aug 2023 07:00:32 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/authentication-principal/</guid><description>In almost every web application, logic related to the user must be executed. To access this, his data is assigned based on his authentication. With Spring Security, the authentication framework in the Spring stack, we have various ways to accomplish this essential task.
Static Access and its Drawbacks In many applications and examples, it is common to statically retrieve the SecurityContext in Spring to access the current UserDetails. However, this has some disadvantages:</description></item><item><title>The Optimal Thread-Pool Size in Java: Explaining the Formula</title><link>https://backendhance.com/en/blog/2023/optimal-thread-pool-size/</link><pubDate>Wed, 09 Aug 2023 07:30:00 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/optimal-thread-pool-size/</guid><description>Determining the optimal size of a thread pool in Java is crucial to maximizing CPU and resource utilization. This decision depends on many factors. Here, we&amp;rsquo;ll show you how to use the famous formula from Brian Goetz&amp;rsquo;s &amp;ldquo;Java Concurrency in Practice.&amp;rdquo; We&amp;rsquo;ll give you a practical example of how to calculate the ratio of wait time to compute time (W/C).
The Formula The formula for the optimal size of a thread pool is:</description></item><item><title>Avoid these 5 Common Performance Pitfalls in Spring Data JPA: Practical Solutions and Tips</title><link>https://backendhance.com/en/blog/2023/5-common-jpa-pitfalls/</link><pubDate>Wed, 02 Aug 2023 07:30:19 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/5-common-jpa-pitfalls/</guid><description>In the world of JVM backend development, Spring Data JPA is an indispensable tool. It provides a convenient and powerful way to manage and manipulate data. However, like any powerful tool, there are pitfalls that can affect performance. In this article, we will explore five common performance pitfalls in Spring Data JPA and present solutions to avoid them.
1. Index Definition with Spring Data JPA One commonly overlooked aspect when working with Spring Data JPA is the proper definition of indexes.</description></item><item><title>Efficient Data Queries with Spring Data JPA Projections</title><link>https://backendhance.com/en/blog/2023/jpa-projections/</link><pubDate>Wed, 26 Jul 2023 07:18:03 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/jpa-projections/</guid><description>In the world of JVM Backend Development, efficient data processing is a crucial concern. One of the main strengths of Spring Data JPA lies in its ability to simplify and optimize interaction with the persistence layer. A particularly powerful feature provided by Spring Data JPA is the use of projections. They offer an excellent way to make data queries more efficient and improve system performance.
What are Spring Data JPA Projections?</description></item><item><title>The Hi/Lo Algorithm in Hibernate: Optimizing Database Identifier Generation</title><link>https://backendhance.com/en/blog/2023/hibernate-hi-lo-algorithm/</link><pubDate>Wed, 19 Jul 2023 06:00:43 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/hibernate-hi-lo-algorithm/</guid><description>In the world of JVM persistence, Hibernate has a firm place. As one of the most popular frameworks for data persistence, it offers a multitude of possibilities to make developers&amp;rsquo; lives easier. One of these possibilities is the Hi/Lo algorithm, a database identifier generation strategy that allows reducing the number of database calls when new entities are persisted.
The Challenge of Identifier Generation Before we dive into the Hi/Lo algorithm, let&amp;rsquo;s briefly look at the challenge of identifier generation in a database.</description></item><item><title>Avoiding Multiple Data Fetches Using the First-Level-Cache in Spring Data JPA</title><link>https://backendhance.com/en/blog/2023/avoid-repeated-fetched-spring-data/</link><pubDate>Wed, 12 Jul 2023 07:08:24 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/avoid-repeated-fetched-spring-data/</guid><description>If you&amp;rsquo;re dealing with backend development on the JVM, you&amp;rsquo;ll surely come across the Java Persistence API (JPA). A well-known implementation framework for it is Hibernate. In this article, we&amp;rsquo;ll show you how you can optimize the performance of your application in Spring Data JPA with caching by preventing the same resources from being fetched multiple times.
What is the First-Level-Cache? Spring Data JPA uses Hibernate as the default ORM (Object-Relational Mapping), which provides an inbuilt First-Level-Cache.</description></item><item><title>Hibernate ORM: Eager or Lazy Loading? When to Use Each</title><link>https://backendhance.com/en/blog/2023/jpa-fetching-strategies/</link><pubDate>Wed, 05 Jul 2023 06:10:09 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/jpa-fetching-strategies/</guid><description>Hibernate is a well-established Object-Relational Mapping (ORM) framework that is widely used in Java development. This framework helps developers optimize the code for database operations such as fetching data. Choosing the right fetching strategy - Eager Loading or Lazy Loading - is crucial for your application&amp;rsquo;s performance. In this article, we will examine these two strategies and discuss when and how you should use them in your Spring Data project.</description></item><item><title>How to Define an Index with Spring Data JPA</title><link>https://backendhance.com/en/blog/2023/how-to-setup-index-in-spring/</link><pubDate>Wed, 28 Jun 2023 07:20:12 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/how-to-setup-index-in-spring/</guid><description>In this article, we will deal with the definition of indexes in Spring Data JPA and the Hibernate Framework. Our focus is on defining an index for a non-primary key and using the @Index annotation.
The proper use of indexes plays a crucial role in optimizing the performance of your database, as they enable faster data queries and overall improve database performance.
Defining an Index with the @Index Annotation With JPA and Hibernate, you can define indexes on entities and non-entity tables such as @SecondaryTable, @CollectionTable, and @JoinTable using the @Index annotation.</description></item><item><title>How to Monitor Your Spring Boot Application with Spring Actuator and Micrometer</title><link>https://backendhance.com/en/blog/2023/how-to-monitor-spring/</link><pubDate>Fri, 16 Jun 2023 13:34:40 +0200</pubDate><author/><guid>https://backendhance.com/en/blog/2023/how-to-monitor-spring/</guid><description>In the world of application development using Spring Boot, it&amp;rsquo;s crucial to focus not just on the development aspect but also on performance monitoring. In this extensive guide, we&amp;rsquo;ll explore the steps to set up monitoring for your Spring Boot application using Spring Actuator and Micrometer, and how to employ Prometheus and Grafana for effective metrics handling and visualization.
Understanding Spring Boot Monitoring Monitoring forms an essential part of ensuring the health of an application.</description></item><item><title>Goodbye Performance Issues: How Project Loom Eliminates Asynchrony</title><link>https://backendhance.com/en/blog/2023/project-loom/</link><pubDate>Mon, 12 Jun 2023 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2023/project-loom/</guid><description>Anyone who develops a backend application with more than a handful of users knows that most performance problems are related to I/O. In modern web applications, these are typically network calls. Whether it&amp;rsquo;s REST requests to another service, queries to an external database, or communication with middleware. We handle all these cases - consciously or unconsciously - in asynchronous threads. This way, we no longer block the main thread. Doing this correctly is not trivial.</description></item><item><title>Accessing Non-Final Property Name in Constructor With JPA</title><link>https://backendhance.com/en/blog/2023/non-final-property-constructor-jpa/</link><pubDate>Sat, 21 Jan 2023 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2023/non-final-property-constructor-jpa/</guid><description>The implications of JPA always manage to surprise me. Yesterday a colleague of mine made me aware of a warning in IntelliJ. The conversation went like that: &amp;ldquo;Marcus, in your blog you explained that we should check constraints in the constructor instead of bean validation . Me: &amp;ldquo;yeah&amp;rdquo;. &amp;ldquo;I wanted to make it right, but when I do it in this entity IntelliJ warns me with Accessing non-final property name in constructor&amp;rdquo;.</description></item><item><title>Don't confuse configuration and constants</title><link>https://backendhance.com/en/blog/2022/dont-confuse-configuration-and-constants/</link><pubDate>Sun, 20 Nov 2022 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2022/dont-confuse-configuration-and-constants/</guid><description>From time to time I experience that an application is unnecessarily configurable. In a recent project I experienced how too many options lead me to feel much more complexity and increased my mental load. Looking deeper into some of the values I saw that these were actually constants that would be dangerous to change &amp;ldquo;on-the-fly&amp;rdquo; anyway. In this post I reflect on this and share my thoughts.
In this project the backend processes data from an embedded devices that communicate through LPWA networks.</description></item><item><title>Microservices are a Big Ball of Mud</title><link>https://backendhance.com/en/blog/2022/microservices/</link><pubDate>Thu, 28 Jul 2022 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2022/microservices/</guid><description>Over the past years I attended hundreds of interviews. Many candidates proudly told tales on how they develop their projects with a microservice architecture. Often (I don&amp;rsquo;t want to say &amp;ldquo;always&amp;rdquo;, but from my memory I think it actually is &amp;ldquo;always&amp;rdquo;) it does not require many questions to see that they used a rocket launcher to kill a mouse. Microservices are hard. Everyone who experienced the pain of operating such an architecture can relate to it.</description></item><item><title>Java Bean Validation is an Anti-Pattern</title><link>https://backendhance.com/en/blog/2022/bean-validation-antipattern/</link><pubDate>Sun, 20 Mar 2022 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2022/bean-validation-antipattern/</guid><description>The javax.validation package is widely used in our industry. And I don&amp;rsquo;t like it. I believe using bean validation is an anti-pattern. It hides business relevant constraints, it leaves the choice when a validation happens to other framework code, and I even saw cases where developers expected that the validation &amp;ldquo;just had to take place&amp;rdquo;, but it never happened. Of course, there was also no test for it. And speaking about tests - testing these business relevant constraints is painful as well.</description></item><item><title>New Position and the Future of This Blog</title><link>https://backendhance.com/en/blog/2021/new-position/</link><pubDate>Sat, 04 Dec 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/new-position/</guid><description>Today I write an unusual post for this blog - A personal note. I recently took the responsibility of the System &amp;amp; Infrastructure department. As you can imagine taking over such a position comes along with a lot of work - especially when you didn&amp;rsquo;t get rid of the old responsibilities yet. That&amp;rsquo;s the main reason why I didn&amp;rsquo;t write a blog in the past months.
But what about the future of this blog?</description></item><item><title>Prefer UUID for your Primary Key</title><link>https://backendhance.com/en/blog/2021/uuid-primary-key/</link><pubDate>Mon, 02 Aug 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/uuid-primary-key/</guid><description>In my last post I discussed the downsides of using numerical types for the primary key of an entity. We should avoid these issues all together by using UUID instead and in this post I will discuss the up- and downsides of this approach.
Using a UUID as the primary ID is simple:
@Entity class Flat( @Id val id: UUID = UUID.randomUUID() ) Generate the ID on the application Similar to numerical ids we can generate it on the database as well.</description></item><item><title>The Inevitable Consequence of a Numerical Id</title><link>https://backendhance.com/en/blog/2021/numerical-id-consequence/</link><pubDate>Thu, 15 Jul 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/numerical-id-consequence/</guid><description>In many (JPA) applications numerical ids are chosen for the surrogate key of the entities. But how do we make sure that they are not used twice? In a scenario where our application needs to scale horizontally we need a solution for that. Most developers come to the conclusion that the database should take care of that. But this is a fragile solution and in this article I want to discuss it.</description></item><item><title>Which Password Encoder Should I Choose With Spring Security?</title><link>https://backendhance.com/en/blog/2021/spring-password-encoder/</link><pubDate>Sat, 15 May 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/spring-password-encoder/</guid><description>Did you work on the task to integrate Spring Security in a project? If yes you probably stumbled upon the decision which PasswordEncoder to use. I saw many developers actively researching that question and deciding on a concrete algorithm. In one project we even choose a less secure decoder - for performance reasons. Don&amp;rsquo;t. Just don&amp;rsquo;t! Don&amp;rsquo;t choose a weak encoder for performance. Actually, don&amp;rsquo;t choose at all! Let Spring handle your security.</description></item><item><title>Some Thoughts about Personal Development Goals for Software Engineers</title><link>https://backendhance.com/en/blog/2021/development-goals/</link><pubDate>Tue, 20 Apr 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/development-goals/</guid><description>Personal development goals in software engineering are not trivial to define. In general, goals should be SMART (Specific, Measurable, Achievable, Realistic and Timely). But in reality our field of expertise is that diverse and complex that it is not as easy to find those goals like in other professions. For someone working in the sales department a revenue goal is easy to define and to decide whether he succeeded or not.</description></item><item><title>Should I Pass JPA Entities as Method Parameters?</title><link>https://backendhance.com/en/blog/2021/passing-jpa-entities/</link><pubDate>Sat, 20 Mar 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/passing-jpa-entities/</guid><description>JPA entities have a couple of pitfalls and consequences when handling them in your application. Especially understanding how JPA manages and synchronizes the state of an entity is essential to avoid unexpected behavior. This can be unintuitive when passing JPA entities as method parameters in Spring Data in- and outside a transaction. In this post I will explain a best practice when working with JPA entities and when it&amp;rsquo;s okay to pass it through method parameters and when you should avoid it.</description></item><item><title>Rules for Extension Functions</title><link>https://backendhance.com/en/blog/2021/extension-functions/</link><pubDate>Sat, 06 Mar 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/extension-functions/</guid><description>In recent reviews I stumbled upon extension functions which didn&amp;rsquo;t quite felt right, but I wasn&amp;rsquo;t able to determine where that gut feeling was coming from. After seeing quite a lot of them I came to some conclusions why that&amp;rsquo;s the case, and I gathered rules for me when extension functions make sense to use and when they should be avoided. I discovered an overuse of the language feature - something you often experience when you work with a new fancy language with nice features.</description></item><item><title>Don't Use The Builder Pattern in Kotlin</title><link>https://backendhance.com/en/blog/2021/dont-use-builder-in-kotlin/</link><pubDate>Sat, 23 Jan 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/dont-use-builder-in-kotlin/</guid><description>This week I was taught again that you should be thoughtful when applying patterns you read on the internet (which is ironic - because the same applies to this post ;-) ). This time colleagues heavily applied the Creational Design Patterns in Kotlin: Builder from Baeldung. Using the builder pattern in Kotlin in this example is an anti-pattern and in this post I will reason why you&amp;rsquo;ll end up with safer, less error-prone and less boilerplate when properly applying Kotlins language features instead of this builder pattern.</description></item><item><title>JPA Doesn't Call Persist But Merge Operation On New Entities</title><link>https://backendhance.com/en/blog/2021/jpa-version-null/</link><pubDate>Thu, 07 Jan 2021 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2021/jpa-version-null/</guid><description>When working with JPA I prefer generating the primary key on the application and not in the database (check out this post from James Brundege ). Additionally, I also prefer optimistic locking and in order to use it you need to specify a @Version field in your Entity. But you need to be careful how to initialize these two fields. In this post I&amp;rsquo;ll talk about an error when you assign a default value for both fields in JPA which leads the EntityManager to never call persist but the merge operation instead when creating a new entity.</description></item><item><title>Favor Polymorphism Over Enumerations</title><link>https://backendhance.com/en/blog/2020/polymorphism-over-enumerations/</link><pubDate>Sun, 01 Nov 2020 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2020/polymorphism-over-enumerations/</guid><description>Last week I reviewed the data design of a colleague. He had to improve a feature and while working on it he noticed that the existing design was not sufficient to properly reflect the changes he had to do. Intuitive he followed the practices of other models in the code and introduced an enumeration to distinguish between different alert types that can be created in the application. Using an enumeration for it is not the optimal solution and in this post I want to describe why you should always question when you see an enumeration in your code and think about solving it with polymorphism instead.</description></item><item><title>Avoid Inconsistent Builder With Lomboks @Builder</title><link>https://backendhance.com/en/blog/2020/avoid-inconsistent-builders/</link><pubDate>Thu, 14 May 2020 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2020/avoid-inconsistent-builders/</guid><description>In a project I worked on I saw that nearly every entity and value object was created with Lomboks @Builder . Their reason is that it makes it easier to construct these objects - especially for tests. But it comes with a cost. The problems that these builders create can&amp;rsquo;t be detected by the compiler and are especially dangerous in every CI environment.
Let&amp;rsquo;s look at an example. This is our object that uses the builder for construction:</description></item><item><title>Best Practices For Unit Tests</title><link>https://backendhance.com/en/blog/2020/better-unit-tests/</link><pubDate>Fri, 06 Mar 2020 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2020/better-unit-tests/</guid><description>Unit tests had a bad reputation in many teams I worked with. To my confusion I even experienced that a team wrote a hell lot of integration tests but rarely any unit tests. This is contrary to the well-known testing triangle, and surprised me quite a bit. The reason - as I was told - was the experience of the team. &amp;ldquo;When you change something you have to adapt many unit tests&amp;rdquo;, was the common tenor.</description></item><item><title>Additional auditing with Spring Data JPA and Hibernate</title><link>https://backendhance.com/en/blog/2020/additional-auditing/</link><pubDate>Tue, 28 Jan 2020 00:00:00 +0000</pubDate><author>Sascha Boeing</author><guid>https://backendhance.com/en/blog/2020/additional-auditing/</guid><description>Spring Data provides an easy way of keeping track who creates and modifies a persistent entity as well as when the action happened by annotating properties with @CreatedBy, @CreatedDate, @LastModifiedBy and @LastModifiedDate. The properties are automatically provided by an implementation of the AuditAware and DateTimeProvider interface.
Beside this common auditing information in my current projects some entities require storing auditing-information about crucial state-changes like soft-deletion.
Previously we had to fill the properties ourself:</description></item><item><title>How To Load A Shared Library From A Subfolder In Jenkins</title><link>https://backendhance.com/en/blog/2020/jenkins-local-shared-library/</link><pubDate>Wed, 22 Jan 2020 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2020/jenkins-local-shared-library/</guid><description>I work with Jenkins Pipeline for three years now and one pain point is proper isolation of shared functionality between pipelines but even steps. In our repository we defined multiple pipelines and some are that large that we share functionality within it. Jenkins offers the possibility to create shared libraries for that purpose. But unfortunately it&amp;rsquo;s not possible to load it from the same repository. Since many of the changes in the pipeline are related to a change of the shared library it was tedious to match the branches and versions to be backward compatible.</description></item><item><title>Boost Your Development With Proper API Design</title><link>https://backendhance.com/en/blog/2019/boost-your-development/</link><pubDate>Wed, 20 Nov 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/boost-your-development/</guid><description>In this post we’ll go through an example application and see which methods and principles we can apply to build a robust application that is easy to maintain, extend, understand and use. In general, this is a subject with a much larger scope than a simple blog post can provide, so the content is neither complete nor exhaustive, but a selection of topics that I visited recently. We use an arbitrary business case where we can buy and sell resources on a market.</description></item><item><title>Automate Your Git Commits On Feature Branches</title><link>https://backendhance.com/en/blog/2019/git-feature-branch-workflow/</link><pubDate>Wed, 13 Nov 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/git-feature-branch-workflow/</guid><description>At some point it hits everyone. Your precious work of several hours is vanished because of a hardware failure. For that the industry came up with several solutions like the idea of version control systems. But recently I was dumb enough to not do any commit for several hours - just to leave the history clean. Big mistake&amp;hellip; But did you think about automating that? How about committing every couple of minutes automatically?</description></item><item><title>How I (also) use JMeter for Integration Tests</title><link>https://backendhance.com/en/blog/2019/jmeter-integration-test/</link><pubDate>Thu, 26 Sep 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/jmeter-integration-test/</guid><description>In my current project I focus on the development of a highly available, scalable system that can handle millions of players worldwide. In order to test and ensure that this is actually the case we need to do regular performance and integration tests. While - for a long time - I explicitly separated both, I choose a new direction in this project by writing the JMeter performance test in a way that it can be used as an integration test as well.</description></item><item><title>Clean Already Merged Branches in Git</title><link>https://backendhance.com/en/blog/2019/git-clean-merged/</link><pubDate>Sun, 08 Sep 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/git-clean-merged/</guid><description>Another month, another git alias (But don&amp;rsquo;t think that this will become a regularity now ;-) ). I had the issue that I lost track of the branches that were already in master a couple of times on one of my projects and after a while I had a lot of unnecessary jobs in Jenkins because we use the Jenkins multibranch plugin . So I sat down and created a git alias that does the cleanup for you with a bit of user-friendly output.</description></item><item><title>How To Squash All Commits Of Your Feature Branch</title><link>https://backendhance.com/en/blog/2019/git-squash/</link><pubDate>Thu, 08 Aug 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/git-squash/</guid><description>Usually you have a lot of &amp;ldquo;intermediate&amp;rdquo; commits while developing on a feature branch like WIP, Review changes, Some cleanup, Fix jenkins. These commits are neither atomic nor does it help to read them in the history. They purely serve the purpose to persist the current work, trigger another build on your buildmachine or doing some fixes you discovered while testing. So before I rebase my changes to master I&amp;rsquo;d like to squash all commits that i&amp;rsquo;ve done to a single one.</description></item><item><title>Parallel Integration Tests With Random Ports On Jenkins</title><link>https://backendhance.com/en/blog/2019/parallel-integration-tests/</link><pubDate>Thu, 01 Aug 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/parallel-integration-tests/</guid><description>A common problem when doing end-to-end tests is colliding ports on you buildmachine with parallel execution. With the technology stack of Docker, Jenkins and Gradle I&amp;rsquo;ll demonstrate one solution I use in my current project to start the backend with a random port and use it in the test execution afterwards.
Our situation is the following: You want to execute a test which starts your backend application and fires against it from the outside.</description></item><item><title>Useful Git Aliases That Ease Your Life</title><link>https://backendhance.com/en/blog/2019/gitaliases/</link><pubDate>Wed, 24 Jul 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/gitaliases/</guid><description>When you work with git you can define aliases to make your experience even more productive and elegant. In this short post I&amp;rsquo;d like to present aliases that I use frequently and how they work. And I&amp;rsquo;ll start with my favorite: git recent-branches.
Recent Branches git recent-branches This command gives you the following output:
The result of the recent-branches alias. This command shows you all branches you recently worked on. That solves the usual problem of me forgetting the names of the branches I worked on.</description></item><item><title>Never Design A Class That Knows How It's Used</title><link>https://backendhance.com/en/blog/2019/class-knowledge/</link><pubDate>Tue, 18 Jun 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/class-knowledge/</guid><description>When you design a class you should never design it in a way that the class itself knows how it is used from the outside. Breaking this principle will make it difficult for other developers providing other implementations. I recently stumbled upon an implementation of different entities where the implementation had to provide a unique id for itself. Why this is causing problems and how you better design such a situation I&amp;rsquo;ll explain in this post.</description></item><item><title>Jenkins Bitbucket Branch Source Plugin's Webhook Is Not Working</title><link>https://backendhance.com/en/blog/2019/bitbucket-jenkins-integration/</link><pubDate>Fri, 24 May 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/bitbucket-jenkins-integration/</guid><description>In my current project we use Bitbucket Server as our Git backend and Jenkins with a pipeline multibranch project to build our project. For better integration of both technologies we decided to use the Bitbucket Branch Source Plugin . This enables us to trigger automated builds and maintain dynamic jobs on our Jenkins. But installing the necessary webhooks turned out to not be a trivial task.
The goals I want to achieve are the following:</description></item><item><title>That's How Wrong Google Analytics Can Be</title><link>https://backendhance.com/en/blog/2019/server-side-tracking/</link><pubDate>Fri, 17 May 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/server-side-tracking/</guid><description>This blog is not very old yet. I just started it a month ago and of course I wanted to know if somebody is even reading it. So after a few days I included Google Analytics to get an impression of the visitors of my page and if I even have an audience here. But barely any visit got tracked and since I didn&amp;rsquo;t even filter out my own ip I had the impression that I&amp;rsquo;m basically the only user of my page.</description></item><item><title>Custom Authentication Filter with Spring Security</title><link>https://backendhance.com/en/blog/2019/custom-authentication-with-spring-security/</link><pubDate>Thu, 09 May 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/custom-authentication-with-spring-security/</guid><description>After answering a question on stackoverflow about how to configure Spring Security with your own authentication mechanism I&amp;rsquo;d like to go into more details in this post. I&amp;rsquo;ll implement a simple use case where the actual authentication is done by reading the username and password from the header of a request.
The example method we implement in this post is NOT a secure way of implementing authentication. I just choose it for the sake of simplicity to demonstrate how to register your own authentication in Spring Security.</description></item><item><title>Jenkins Declarative Pipeline throws Method Code Too Large Exception</title><link>https://backendhance.com/en/blog/2019/jenkins-pipeline-method-too-large/</link><pubDate>Thu, 02 May 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/jenkins-pipeline-method-too-large/</guid><description>I use the declarative Jenkins pipeline in my current project, but after 2 years of development we hit a barrier I wasn&amp;rsquo;t aware of. Jenkins puts the whole declarative pipeline into a single method and at a certain size the JVM fails with java.lang.RuntimeException: Method code too large!. Digging deeper it turns out that no method is allowed to exceed 64k . So I needed to find a solution for this problem.</description></item><item><title>Distinguish Between Optional and Mandatory Parameters in the Builder Pattern</title><link>https://backendhance.com/en/blog/2019/robust-builder-pattern/</link><pubDate>Mon, 29 Apr 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/robust-builder-pattern/</guid><description>After reading through Designing Bulletproof Code by Otavio Santana I stumbled upon its example of using a builder pattern. While this was not the focus of the article itself I also realized that I saw the issue in the past a lot and I ran in it as well. The widely spread understanding of the builder pattern (as described in Effective Java by Joshua Bloch) does not differentiate between optional and mandatory parameters and that makes their usage not easier but harder.</description></item><item><title>Code-Held Goes Open Source</title><link>https://backendhance.com/en/blog/2019/code-held-goes-open-source/</link><pubDate>Sat, 27 Apr 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/code-held-goes-open-source/</guid><description>Today I have an awesome Message. Since I also post about technologies I use on this page I decided to put the whole page open source on gitlab . Feel free to discover how I developed this blog and which technologies I use.
I had the project in a private repository before but after many considerations I decided to not transform it directly into public space, because I used to have my nginx config in there as well and at some point unmasked ssh keys (I exchanged them of course but you never know&amp;hellip;).</description></item><item><title>Transparent Gradient Effect on Background Image</title><link>https://backendhance.com/en/blog/2019/transparent-gradient-background-image/</link><pubDate>Fri, 26 Apr 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/transparent-gradient-background-image/</guid><description>I built a new neat feature on my blog posts detail page that displays check constraints in the constructor instead of bean validation as a background image in the top of the rendered page. The trick to get the transparent fading effect via css is using a linear-gradient on top of the actual image.
It&amp;rsquo;s important to state that the linear-gradient effect is applied to the whole size of the block.</description></item><item><title>Build With Jekylls' Docker Image and Gitlab CI</title><link>https://backendhance.com/en/blog/2019/build-with-jekyll-docker-image-and-gitlab-ci/</link><pubDate>Tue, 23 Apr 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/build-with-jekyll-docker-image-and-gitlab-ci/</guid><description>Since I don&amp;rsquo;t want to install and manage a compatible version of Ruby for my Jekyll version and all dependencies of my website I decided to use Jekylls&amp;rsquo; Docker image to develop this page. For my build pipeline in Gitlab CI I wanted to make use of these already existing definitions.
I created a simple docker-compose.yml file that loads my source files as a volume, like explained in the documentation of Jekyll&amp;rsquo;s Docker Image :</description></item><item><title>Reference Jekyll Post Image With Assets Plugin</title><link>https://backendhance.com/en/blog/2019/jekyll-posts-image-with-assets-plugin/</link><pubDate>Sun, 21 Apr 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/jekyll-posts-image-with-assets-plugin/</guid><description>For every blog post I specify an image that is shown on the front page. I also use the jekyll-feed plugin to generate an rss feed. This plugin uses the front matter information to generate the necessary meta-data. So the image front matter data is used to fill the &amp;lt;media:thumbnail&amp;gt; tag in the feed. But the jekyll-assets plugin don&amp;rsquo;t need fully qualified paths to the assets but just its name. So I needed to find a solution for this.</description></item><item><title>Randomly Failing Playmode Tests in Unity</title><link>https://backendhance.com/en/blog/2019/unity-playmode-tests-in-ci/</link><pubDate>Fri, 19 Apr 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/unity-playmode-tests-in-ci/</guid><description>For the last year my current project developed several playmode tests in Unity. These tests get executed by our Jenkins as part of our continues integration strategy. But since we started using them we experienced strange randomly failing tests because they reached their timeout.
Today we finally found the issue! Until now (version 2018.2), Unity (on MacOS? We don&amp;rsquo;t build on Windows machines) slows down when no output device is detected and the user is not logged in.</description></item><item><title>Welcome to my Blog</title><link>https://backendhance.com/en/blog/2019/welcome-to-my-blog/</link><pubDate>Tue, 16 Apr 2019 00:00:00 +0000</pubDate><author/><guid>https://backendhance.com/en/blog/2019/welcome-to-my-blog/</guid><description>Previously I only used to have a simple portfolio website at this place. But in my day-to-day work I figured that I actually get in touch with a lot of awesome technology and daily I discover something interesting that is worth writing about to help others in the same situation. This is what this blog will be about. I&amp;rsquo;ll share my knowledge, give hints on problems related to programming and operating a modern software and tell my opinion on programming styles and recent debates.</description></item></channel></rss>