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:

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 […]

Using @ConfigurationProperties to separate service and configuration

Roughly about two years ago, I wrote an article called “Why using Spring’s @Value annotation is bad“. I described why you should avoid @Value annotations all throughout your code. By using @Value annotations in services, controllers and other Spring components, you will scatter your configuration through the complete application. In the worst case, you will […]