Java

Effectively use MapStruct and Lombok's builder

Posted on by  
Willem Cheizoo

Since MapStruct version 1.3.0.Final is out, we are able to better integrate with Lombok Builder pattern. MapStruct is a library that takes away a lot of boilerplate code for mapping between POJO’s. With MapStruct there is no need for implementing the real mapping itself.

With Lombok we can use a Builder pattern and mark an object as a Value(Object). It will result in an immutable object. This blog post shows how we can use MapStruct to use the Builder pattern of Lombok.

Continue reading →

Run one or Exclude one test with Gradle

Posted on by  
Mathijs de Groot

From time to time you only want to run one test, one test method, one class or one package from the command-line. Or on the contrary: you want to exclude / ignore one specific test or group of tests during the build cycle. Excluding tests from the build cycle by the command line usually occurs when the following scenarios meet:

  • A test requires significant amount of resources (time, memory, disk space, etc.)

  • The run needs to be independent from the IDE (to reenact the Continuous Integration / Continuous Delivery pipeline) as some IDEs load test-dependencies on the compile-time class-path.

  • You have no or limited ability to change the code-base

Continue reading →

Spicy Spring: Creating a Fully Executable Jar

Posted on by  
Willem Cheizoo

With a Spring (Boot/Cloud) application you can create a fully executable JAR, where the jar can be run from the command-line by just calling ./my-own-jar-0.0.1.jar. My colleague Mr. Haki wrote Grails Goodness: Creating A Fully Executable Jar. Together with the famous one-liner of Josh Long in mind: "Make JAR not WAR!", create a JAR whenever you develop a Spring Boot/Cloud application. As described in Mr. Haki's blog, it is very easy to make our Spring application executable:

 org.springframework.boot
    spring-boot-maven-plugin
    true 

## Gradle configuration

```gradle
apply plugin: 'spring-boot'

springBoot {
    executable = true
}

Continue reading →

shadow-left