Micronaut @ConfigurationBuilder Example

Micronaut @ConfigurationBuilder allows us to bind configuration files to Java objects using builder pattern. Table of contents 1. Defining Configuration in application.yml 2. Builder Pattern 3. Using @ConfigurationBuilder 4. Injecting the Configured Database 5. Running the Application 6. Unit Tests 7. Download Source Code 8. References Technologies used: Java 21 Micronaut 4.7.6 Maven 3.x 1. …

Read more

Java Builder pattern examples

The Builder Pattern in Java is a creational design pattern that helps in constructing complex objects step by step. Here are three examples of the Builder pattern in Java: 1. Building a User Profile This example models a User with optional fields using the Builder Pattern. User.java package com.mkyong.builder; class User { private final String …

Read more