Visual Studio Code: Java, XML and Quarkus--an podcast episode

Subscribe to podcast via: spotify| iTunes| RSS

The #91 episode with Fred Bricon (@fbricon) about:
Visual Studio Code (VSC) support for Java, Quarkus, Microprofile and XML
is available for

Kafka, JAX-RS, MicroProfile, JSON-B, GSON, JWT, VSC, NetBeans, Java Fullstack--75th

75th episode started with a few viewers questions and ended answering 20+ topics like:

"Kafka vs. JAX-RS / RPC, thoughts about APIs, JSON-B vs. GSON, Path.of over Paths.get, Java Records, MicroProfile JWT, beginners vs. expert content, best Java fullstack, code coverage, NetBeans in 2020, Visual Studio Setup for Java, screencast configuration, ReactJS / Angular over JSF?, JSON-P vs. JSON-B, security code scanning"

Any questions left? Ask now: and get the answers at the next

JUnit 5: The Single Dependency You Need

JUnit 5 requires a single dependency in the pom.xml:


...unfortunately, you will also have to declare the maven-surefire-plugin with version >=2.22.2:


Bruno Hates YAML-Microsoft Loves Java--an podcast episode

Subscribe to podcast via: spotify| iTunes| RSS

The #90 episode with Bruno Borges (@brunoborges) about:
how YAML helps you to focus on whitespaces, Java at Microsoft, MicroProfile and metrics for cloud-native Java services
is available for

Kafka over JAX-RS, Spring to MP, JSON to POJO, Java Records, Code Coverage--or 75th

Topics ( for the 75th (always first Monday of the month, 8pm CET / CEST):

  1. Kafka over JAX-RS?
  2. Migrations from Spring & AngularJS to JakartaEE/MicroProfile & Web Components
  3. JSON-B vs. GSON and the importance of APIs
  4. Thoughts on JSON to POJO mapping conventions
  5. Path.of over Paths.get
  6. Whats the point of Java Records?
  7. Is it possible to use the same MP JWT configuration on various servers / runtimes?
  8. Beginners vs. "expert" content
  9. The best "fullstack"
  10. Dangerous "Increasing Code Coverage" screencast
  11. NetBeans in 2020/2021
  12. Visual Studio Setup for Java
  13. screencast configuration

Any questions left? Ask now: and get the answers at the next

Java 14+: Java Record JSON Serialization and Deserialization with JSON-B

To serialize a Java 14 POJR (Plain Old Java Record):

public record Developer(int age, String language) {
You can use stock JSON-B Jakarta EE API:

import javax.json.bind.Jsonb;
import javax.json.bind.JsonbBuilder;
import org.junit.jupiter.api.Test;

public class JavaTest {

    public void jsonb() {
        Jsonb jsonb = JsonbBuilder.create();
        var developer = new Developer(25, "java");
        var serialized = jsonb.toJson(developer);
        System.out.println("serialized = " + serialized);
        var clone = jsonb.fromJson(serialized, Developer.class);
        System.out.println("clone = " + clone);

Java Record serialization might be not available with all SPI implementations. However, Apache Johnzon supports it out-of-the-box:


See it in action and from scratch in 3 mins:

The above unit test generates the following output:

serialized = {"age":25,"language":"java"}
clone = Developer[age=0, language=null]    
Thanks to @rmannibucau for the commits :-)

Java 14 Record and Map.Entry

With a Java 14+ record:

import java.util.Map;

public record Developer(String language, int age) {
    public Developer(Map.Entry<String, Integer> entry) {
        this(entry.getKey(), entry.getValue());
} Map.Entry of Java's Map:

var developers = Map.of(
            "java", 25,
            "javascript", 24,
            "ruby", 30);

...can be directly converted into a record instance:


The snippet prints the following output:

Developer[language=java, age=25]
Developer[language=javascript, age=24]
Developer[language=ruby, age=30]

See it in action and from scratch in 3 minutes:

A Java Record can also come with additional methods / logic:

public record Developer(String language, int age) {
    public String nicerOutput() {
        return "I'm a " + this.language() + " developer and " + this.age() + " old";

...and used inside the stream:


The code above prints:

I'm a javascript developer and 24 old
I'm a ruby developer and 30 old
I'm a java developer and 25 old    

What is the Direction of Quarkus?--an podcast episode

Subscribe to podcast via: spotify| iTunes| RSS

The #89 episode with John Clingan (@jclingan) about:
MicroProfile, clouds, quarkus (support by RedHat) and quarkus "bottom up" approach, strategic goals and directions
is available for

Java 11: Write a String To File

With the method writeString introduced in Java 11, writing a String to a file takes a single line:

import static org.junit.jupiter.api.Assertions.assertEquals;
import java.nio.file.Files;
import java.nio.file.Path;
import org.junit.jupiter.api.Test;


public void writeString() throws IOException {
    Path fileName = Path.of("celebration.txt");
    String content  = "duke is 25";
    Files.writeString(fileName, content);
    String actual = Files.readString(fileName);

Java 14: A Simple Record

A Java record:

public record Article(String title, String content) {} a ready to use Data Transfer Object (DTO).

equals,hashCode, toString and private final field with corresponding accessors are generated as well.

The following code:

var article = new Article("java 14", "hello,record");
System.out.println("article = " + article + " " + article.content() + " " + article.title());

prints the following output:

article = Article[title=java 14, content=hello,record] hello,record java 14    

See it in action and "from scratch" in 4 mins:

Online Workshops
...the last 150 posts
...the last 10 comments