Contact Us About Sponsorship

Questions about Micronaut Foundation sponsorship?

Please complete this form, and we’ll follow up with you shortly.

[hubspot type=form portal=4547412 id=a7b3ddfa-64b0-47fd-8358-45fa6a09456a]

Micronaut Framework 4.1.0 Released!

by Sergio Del Amo Caballero

The Micronaut Foundation is excited to announce the release of Micronaut framework 4.1.0!

It contains a minor release of Micronaut Core with exciting features:

 

Bean Mappers

With Bean Mappers you can automatically create a mapping between one type and another.

@Introspected
public record Contact(String name) {
}

@Introspected
public record ContactEntity(String firstName, String lastName) {
}

public interface ContactMapper {
    @Mapper.Mapping(
        to = "name",
        from = "#{entity.firstName + ' ' + entity.lastName}"
    )

    Contact contactEntityToContact(ContactEntity entity);

}

@MicronautTest
class ContactMapperTest {
    @Inject
    ContactMapper contactMapper;

    @Test
    void mappingWithExpressionsWork() {
         ContactEntity e = new ContactEntity("Sergio", "del Amo");
        assertEquals(new Contact("Sergio del Amo"), 
          contactMapper.contactEntityToContact(e));
    }
}

As illustrated in the previous example, you can use the compile-time, reflection-free and type safe Expression Language introduced in Micronaut framework 4.

 

Introspection Builder

If a type can only be constructed via the builder pattern, you can use the builder member of the @Introspected annotation to generate a dynamic builder.

@Introspected(builder = @Introspected.IntrospectionBuilder(
builderClass = Person.Builder.class
))
public class Person {
    private final String name;
    private Person(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }
    public static Builder builder() {
        return new Builder();
    }
    public static final class Builder {
        private String name;
        public Builder name(String name) {
            this.name = name;
            return this;
    }
        public Person build() {
            Objects.requireNonNull(name);
            return new Person(name);
        }
    }
}
BeanIntrospection<Person> introspection = 
  BeanIntrospection.getIntrospection(Person.class);
BeanIntrospection.Builder<Person> builder = introspection.builder();
Person person = builder
    .with("name", "Fred")
    .build();

KSP Improvements

Micronaut Framework 4.1. contains multiple improvements for users building Micronaut applications with Kotlin Symbol Processing (KSP)

Micronaut Data

This release contains a minor release of ​​Micronaut Data which supports nested transaction propagation.

Micronaut Flyway

This release contains a minor release of ​​Micronaut Flyway which updates to Flyway 9.12.2.

Micronaut Kafka

This release contains a minor release of ​​Micronaut Kafka with multiple features, including improvements around Kafka Offsets and multi-language documentation.

Micronaut Security

This release contains a minor release of ​​Micronaut Security, which adds extra information to the login failed event to ease debugging.

Micronaut Logging

This release contains a minor release of ​​Micronaut Logging which updates to Logback 1.4.11.

Micronaut Email

This release contains a minor release of Micronaut Email which improves reply-to support and Attachment.disposition.

Neo4j

This release removes the Neo4j test harness in favor of Testcontainers Neo4j. EmbeddedNeo4jServer – which utilizes the test harness – has been deprecated and will be removed in a future version.

Micronaut OpenAPI

This release contains a minor release of ​​Micronaut OpenAPI, which continues to improve the compile-time generation of OpenAPI documentation for your Micronaut application.

Micronaut RabbitMQ

This release contains a minor release of ​​Micronaut RabbitMQ, which adds support for AMQP “mandatory” flag and triggers application events before/after a RabbitMQ consumer subscribes to a queue.

Micronaut Serialization

This release contains all the improvements of Micronaut Serialization with support for decoding base64 to byte[], improvements to JsonUnwrapped, and support for @JsonDeserialize(builder=…).

Micronaut Servlet

This release contains a minor release of ​​Micronaut Servlet with updates to embedded undertow and tomcat and it documents how to use external configuration in WAR deployments.

 

NEXT STEPS

If you haven’t yet updated to Micronaut framework 4, this is an excellent opportunity to do so!

Please feel free to reach out to us if you need any assistance.