I’ve been working lately on a project with a few services (or microservices, if you like to play buzzword bingo). I wanted to share some thoughts on how using Swagger together with MapStruct can make things easier.
Following up the previous post about swagger, in this post I’m using the maven plugin version of swagger code generator.
How to generate PNG barcodes in Java using the zxing library:
To copy from a stream into a file:
import java.nio.file.Files; import java.nio.file.Path; Files.copy(inputStream, path);
To copy from a stream into another stream, assuming you’re using Spring:
import org.springframework.util.StreamUtils; StreamUtils.copy(inputStream, outputStream);
exclude configuration works with classes, so the
.class extension is relevant in specifying the path.
<plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.1</version> <configuration> <excludes> <exclude>com/acme/models/Spring*</exclude> <exclude>com/acme/api/*Api.class</exclude> <exclude>com/acme/generated/**/*</exclude> </excludes> </configuration>
To verify a method that returns
void with Mockito, you need to do this: