Testcontainers

java

Recently I’ve found a very interesting project which allows to spin up docker containers for test purposes. Writing tests checking integration with external services is not an easy task. With testcontainers library it gets simpler because you can have external service up and running just for your test in a couple of lines of code.

18 Jul 2019

Spock extensions

java

Recently I had to set up some extra logic to be executed before running tests. I had two options - create yet another abstract class with some behavior or somehow extend Spock and introduce extra logic to be executed just before actual test starts. As we already have enough of abstract classes I decided to try and do the second option.

11 Jul 2019

Forcing conventions

java

When the whole team agrees on coding standards we tend to be optimistic. We think that from now on everything will be exactly as we decided. The truth is that usually after a couple of months you’ll reinstall IDE or system and forget about configuration or new people join and it’s the Wild West all over again.

27 Jun 2019

ProxyFactory and ProxyFactoryBean in Spring

java

Spring provides many easy to use abstractions and you use many of them without even knowing about them. You probably know that in order to have @Transactional or @Cacheable annotation work spring creates proxies for you (sometimes proxies on top of proxies…​), but have you ever wondered how it’s happening under the hood? What Creation of object proxies is a cumbersome task. One has to decide if the proxy should be created using native java mechanisms (JdkProxy available only on interfaces) or using cglib and it’s complicated interfaces.

13 Jun 2019

Simplified application versioning with maven

java

Version management in maven (especially in multi-module projects) was not pleasant and required multiple build steps, some magic commands and maybe bash script here and there. With version 3.5.0 new cool feature has been added to maven. From this version you can easily customize your build number from build tools using simple properties like ${revision} ${sha1} and ${changelist}.

29 May 2019

My first maven plugin

java

In the past, I’ve been doing various things with maven. Some of them were standard, some were more complicated and a couple of them were complex. For those complex solutions, I felt like I needed a plugin but I’ve never had enough time to write it properly. In this post, I’m going to explore the basics of writing maven plugin.

10 May 2019

Spring internals - BeanDefinition

java

How beans are registered in spring and what is the base of beans creation, how to extend spring’s context to our needs? In this post, I’m going to dig into the foundation of many mechanics in spring framework - bean definition.

29 Apr 2019

Spring's properties misconfiguration dangers

java

Some time ago I’ve faced a very interesting support issue. Long story short it turned out that one of our applications was not connecting to proper service and as a result, it’s been displaying invalid data to users. After a bit of investigation, I’ve noticed that spring’s configuration mechanism did fallback to default value because of missing configuration key for the production profile. In this post, I’m going to present to you how we are going to avoid similar issues in the future.

11 Apr 2019

spring.factories

java

Have you ever wondered how it’s possible that spring-boot is able to pick up whatever you have on the classpath and configure application context to your needs based on some conventions and bit of black magic? In this post, I’m going to dig into spring.factories file on which most of the spring-boot power is based.

28 Mar 2019