Java Digest # VI: Spring Boot III.II, AWS Lambdas on Java XXI, Amazon Q, RabbitMQ III.XIII

Java Digest # VI: Spring Boot III.II, AWS Lambdas on Java XXI, Amazon Q, RabbitMQ III.XIII

?? Aloha, friends!?

Tell me, do you love spring as much as we do? Yes? Well, then, this issue is for you! Because there will be a lot of news about Spring.

In addition, in this issue, you will find news about the latest events in the world of Java for November.

And don't get tripped up by those Roman numerals. Just keep a keen eye on our digest, and you'll figure it all out in an instant ??????

You can read the previous digest here.

We never stood aside from Twitter trends

? Java

Although the main focus of this digest issue is the long-awaited release of new versions of Spring and Spring Boot, there was also a lot happening in the world of Java.

After completion of the review, JEP CDLX: Vector API (Seventh Incubator) was promoted from Proposed to Target to Targeted for JDK XXII. Under Project Panama's auspices, this JEP incorporates enhancements in response to feedback from the previous six rounds of incubation.

JEP CDLIX: String Templates(II Preview) was also promoted to “Proposed to Targeted” for JDK XXII.

The discussion on the OpenJDK mailing list addresses a question about the syntax of String Templates in Java, particularly why both a template prefix (like <processor>.) and the backslash (`\`) are required for embedded expressions. Brian Goetz explains that several factors, including the need for uniformity and ease of migration for existing Java code, influenced this design choice. Java programs often contain string literals with dollar signs, which could conflict with template expressions if not handled carefully. The backslash escape mechanism is already established in Java, making it a logical choice for extending to template expressions. This approach ensures seamless use of existing strings with new features, reduces linguistic complexity, and lowers the risk of errors. The use of backslashes, rather than inventing a new escape mechanism, aligns with existing practices and minimizes the learning curve for Java developers.

Gavin Bierman has published a draft specification for JEP CDLXIII: Implicit Classes and Instance Main Methods (II Preview) to the broader Java community. Now, this feature is awaiting its review.

In the LVIII issue of Inside Java, Nicolai Parlog discusses Java on GPU.

Java On The GPU - Inside Java Newscast #58

In the XXI issue of JEP Cafe, José Paumard explains how to optimize your equals methods using pattern matching.?

In his Sip of Java, Billy Korando demonstrates the advantages of pattern matching for switch.

Also, and this is not a drill, emoji support in Java XXI has been significantly improved!

Java 21 Improved Emoji Support ??


?? Spring Updates

This day has arrived! We have finally seen the full release of Spring Framework VI.I and Spring Boot III.II. On this occasion, we want to share the most exciting changes included in the release versions. And there are indeed many of them! So, let's prepare some tea with biscuits and dive into the latest innovations.

Recently, Java XXI was released, bringing numerous innovations. However, the most exciting is the introduction of virtual threads. The Spring team has been considering using virtual threads for quite some time. The main goal was to implement virtual threads without completely rewriting the API to simplify the transition for all interested developers. And what can we say? They succeeded.

To use virtual threads in your projects, you need to do two things:

  1. Your project must use Java XXI.
  2. You need to add the global setting spring.threads.virtual.enabled and set its value to true.

That’s it, happy life.

When virtual threads are enabled, Tomcat and Jetty will use them to process requests. It means that the code in your application that handles web requests, such as a method in a controller, will be executed in a virtual thread. Additionally, virtual threads have also impacted other Spring components. Here are some of them:

  • Usage of virtual threads is automatically applied to TaskExecutor and TaskScheduler, impacting both Spring MVC and Spring WebFlux.
  • Virtual threads are automatically used for RabbitMQ listeners.
  • Kafka listeners also utilize virtual threads.
  • ClusterCommandExecutor from Spring Data Redis will, by default, use virtual threads.
  • Spring for Apache Pulsar employs virtual threads for ConcurrentPulsarListenerContainerFactory and DefaultPulsarReaderContainerFactory.

It's important to note that virtual threads are not a one-size-fits-all solution for all projects. Therefore, the editors recommend conducting empirical research before use. We look forward to hearing your impressions and thoughts on using virtual threads in your Spring Boot projects.

Another significant innovation is the initial support for JVM Checkpoint Restore (Project CRaC).

We double dare You

Let's take a closer look at it. What exactly is Project CRaC? As you may know, Java applications require some time to initialize before processing requests. This problem is known as a cold start, and with the emergence of serverless technologies (such as AWS Lambda), addressing it has become a priority.

Various technologies have emerged in recent years to address the cold start problem in Java applications. These include GraalVM native images, AppCDS, and Project CRaC. Each of these solutions addresses the problem differently, but currently, our focus is on Project CRaC.?

The acronym CRaC stands for Coordinated Restore at Checkpoint. It is an OpenJDK project developed by Azul Systems to accelerate JVM startup time by capturing/freezing its working state, where all the heavy lifting (class loading, JIT compilation, code optimization, etc.) is performed, and serializing this state to disk (Checkpoint) for later restoration (Restore). As a result, the program is in the same state as at the time of creation of the control point.

To utilize the innovations of Project CRaC, the following are required:

  1. A JVM with an enabled checkpoint/restore feature, currently available only for Linux. As of now, this includes Azul and Liberica distros.
  2. The org.crac:crac library in the classpath supports versions 1.4 and above.
  3. Specifying necessary Java command line parameters, such as -XX:CRaCCheckpointTo=PATH or -XX:CRaCRestoreFrom=PATH.

In the image below, you can see the time to the first operation, both with and without CRaC. The results are from this repository.

If you're interested in this functionality, here is a repository with a demonstration project.

It's important to note that the files created by CRaC contain a representation of the active JVM in memory, which may include secrets and other confidential data. It's recommended to use this feature while considering that any values "seen" by the JVM, such as configurations from the environment, will be saved in these files. Therefore, it's crucial to thoroughly assess the security implications of how and where these files are generated and stored.

In terms of innovations, the new RestClient and JdbcClient also deserve attention. If you have experience with Spring WebFlux, you will find many similarities between these new clients, WebClient and DatabaseClient.

RestClient can be a decent replacement for RestTemplate, as it offers a convenient DSL (Domain-Specific Language). For more details about this new client, refer to its documentation.

In turn, JdbcClient is a modern alternative to JdbcTemplate, featuring a user-friendly interface similar to the DatabaseClient in R2DBC. This makes it suitable for developers looking for an updated approach to JDBC operations with a more intuitive and efficient interface.

The feature to reload SSL bundles on the fly has been added, and Tomcat and Netty currently support it. Enabling automatic reloading is straightforward. You must add configuration? spring.ssl.bundle.pem.mybundle.reload-on-update and set its value to true. This enhancement dramatically simplifies updating SSL certificates without restarting the server, thereby improving operational efficiency and security compliance.

Under the hood, a file watcher analyzes the files and reloads them if they have changed. Using the configuration

spring.ssl.bundle.watch.file.quiet-period         

you can set a quiet period for the file watcher. This feature allows for efficient and timely updates of SSL certificates without unnecessary reloads, ensuring both security and minimal impact on system performance. Click here for more detailed information.

Support for Apache Pulsar has been added. The new starter introduces automatic configurations for key components like PulsarClient, PulsarTemplate, and @PulsarListener, which are used both as message senders and receivers. It also adds support for various authentication methods and TLS. You can read more here.?

Numerous changes related to the Micrometer have also been added. You can find the details in the release notes.

These are just a few of the updates that have been included. You can familiarize yourself with other changes here and there.

Additionally, if you prefer video content, the Starbuxman himself, Josh Long has created an excellent overview of all the significant changes. Spring Tips: Spring Boot 3.2

Indeed, November was a busy month with several maintenance releases. These include:

Spring Session III.II reached General Availability (GA). It introduced SessionIdGenerator for custom session ID generation and secure deserialization of Redis sessions.

Spring Security VI.II also reached GA. Notably, cors() is automatically enabled in this new version if a CorsConfigurationSource component is present.

GA release for Spring Data MMXXIII.I. was announced, introducing support for virtual threads and CRaC. Maintenance releases for Spring Data MMXXIII.N.VI, MMXXII.N.XII, and MMXXI.II.XVIII were also issued.?

Spring Modulith has released two versions: I.I GA and I.N.III. Some of the most exciting changes in I.I include:

  • Support for event externalization for AMQP, Kafka, JMS, AWS SNS, and SQS.
  • Support for actuators in native images.
  • Neo4j implementation for event publication repositories.
  • API for handling completed and uncompleted event publications.
  • New documentation based on Antora.

Spring Vault III.I: Adds support for Spring Framework VI.I, new Antora-based documentation, JWT authentication, and other improvements.

Spring Tools IV.XX.I: Brings enhancements related to Spring Boot, Eclipse, VS Code, and Theia.

Spring Shell: Four versions were released, the details of which can be found in their respective documentation.

Spring Authorization Server I.II: GA version was released.

Spring for GraphQL I.II.IV: Includes bug fixes, minor improvements, and updated documentation.

Spring for Apache Kafka and Spring for RabbitMQ: Released version III.I.

Spring Cloud MMXXIII.N.N-RCI (aka Leyton): Built on Spring Boot III.II.N-RCI. Major changes can be found in the Spring Cloud Stream project.

Spring Batch: Three versions were released: V.I GA, V.N.IV, and IV.III.X. Version V.I includes dependency updates, virtual threads support, memory management improvements in JpaItemWriter, new Antora-based documentation, and more.

Spring Integration VI.II: The GA version features numerous improvements, including Antora-based documentation, support for virtual threads, and CRaC support.


????? Java in Clouds

  • AWS Lambda now supports Java XXI!?
  • Additionally, AWS Lambda has introduced three new configurations for more convenient logging. You can now set the log format to JSON, change the log level, and customize which CloudWatch log group to use. These innovations are designed to simplify viewing and searching logs in CloudWatch. However, there are some requirements and limitations regarding the loggers and runtimes that can be used in functions. More details can be found here.
  • A new version III.N.III of spring-cloud-aws has been released, featuring various enhancements and fixes for services such as SQS, S3, SNS, and other AWS services. More details here.
  • AWS has made available zero-ETL migration from AWS Aurora MySQL to AWS Redshift. Instead of writing ETL migrations manually, this task can now be entrusted to AWS, which promises to transfer new data to Redshift in just a few seconds and for free. More about this and a practical example can be found in this blog post.
  • The Amazon DynamoDB zero-ETL integration with Amazon OpenSearch Service, now generally available, enables seamless and automatic replication and transformation of DynamoDB data for search purposes without needing custom code or infrastructure. This integration significantly reduces the operational effort and costs of maintaining data pipeline architectures, keeping data synchronized, and updating code for frequent application changes.
  • Amazon has introduced the preview of Amazon Q Code Transformation, a new tool leveraging generative AI to simplify the process of upgrading and modernizing existing (currently only) Java application code, but not just that. This innovative assistant, Amazon Q, is specifically designed for professional use and offers customization options to align with various business needs.
  • Amazon has announced the preview of the Amazon Aurora Limitless Database, an advanced database solution capable of automated horizontal scaling to handle millions of write transactions per second and manage petabytes of data within a single Aurora database.
  • The new version of Akka XXII.X includes Akka Edge, a toolkit for developing systems that encompass cloud environments, including Edge locations. The most essential part of Akka Edge is Projections over gRPC, a mechanism for asynchronous communication between services. More information is on the Akka Edge blog.
  • Microsoft for Java Developers has released a short video about deploying a native image on Azure Spring Apps and how much resources and initialization time can be saved.

  • Microsoft's Bing Search will utilize Oracle Cloud Infrastructure (OCI) resources for Bing Conversational Search. The AI models for Bing require more resources than Microsoft appears to have, leading to a deepening collaboration between Oracle and Microsoft. Beyond the availability of GPU resources necessary for Bing, another advantage of Oracle is RDMA (Remote Direct Memory Access) for ultra-fast network communication. This joint step for Oracle and Microsoft follows several similar previous announcements, such as Oracle Interconnect and Oracle Database@Azure.

  • Starting from AWS SDK version II.XXI.XIX, the AWS JSON protocol will replace the AWS query protocol. The old protocol employed XML for serializing HTTP calls. This replacement is expected to reduce the load on SQS clients and decrease the time for network communication with SQS servers.
  • AWS has released technical details about the scaling improvements of AWS Lambda functions that read data from AWS MSK (Managed Streaming for Apache Kafka). These enhancements should be most noticeable in scenarios with rapidly increasing data volumes.
  • On Microsoft's blogs, there is an article listing the improvements made to Azure Spring Apps in the third quarter of MMXXIII. Additionally, there is an article about integrating Spring Cloud Gateway with Microsoft Entra ID (formerly Azure Active Directory) through OAuth II.N.

  • Azure has announced plans to expand support for TLS I.III in Web Apps, Functions, and Logic Apps towards the end of MMXXIII and the beginning of MMXXIV. They also mentioned early access to a new type of hosting for Azure Functions, named Flex Consumption.
  • In AWS DynamoDB, it's possible to perform ACID transactions involving operations on one or more tables within a single region. A Senior Principal Engineer at AWS has addressed in an article how this is achieved without compromising the performance of non-transactional operations. This explanation will likely delve into the underlying mechanisms and technologies enabling DynamoDB to maintain high performance while supporting transactional integrity.
  • Although it's not exactly news anymore, here's a comparison between AWS, Azure, GCP, IBM, and Oracle regarding outbound traffic pricing (i.e., from the cloud to the internet) in MMXXIII. Suppose you're interested in such comparisons and studies. In that case, you can find many more exciting materials and projects from the company Cloud-mercato - for example, comparing more than twenty cloud data storage services active in Europe.


?? Other news

  • RabbitMQ III.XIII is expected by the end of this year (the team at VMware even mentioned November), and you can check out what interesting features it will include in this video (spoiler - support for MQTT5, classic queues, Khepri as a new internal DB, and stream filtering). RabbitMQ: what's coming in 3.13 (team update: 26 October, 2023)?
  • JHipster has released version IIX of its product, and Micronaut has released version IV.II of its framework.
  • If you work with Apache Pulsar and have been waiting for the day when it can be conveniently used in the Spring ecosystem, that day has arrived - the Spring module for Apache Pulsar has received version I.
  • Here is a useful article about table partitioning by Hibernate expert Vlad Mihalcea.
  • Gunnar Morling tirelessly continues the promotion of CDC (Change Data Capture) to the masses. This time, he presents an article discussing whether the CDC violates encapsulation.
  • The article on Thomas Vitale's website discusses Software Bill of Materials (SBOMs) for Java applications, highlighting their role in identifying software components to facilitate vulnerability scanning, license checks, and risk analysis in supply chain security.
  • The recent release of Apache Kafka III.VI has introduced new capabilities in the form of tiered storage. If you want to learn more about this new feature, you can read the material by Mickael Maison.
  • If you are interested in learning about real-world applications of Java and Large Language Models (LLM), then this is the place for you.


?? Netflix & Chill

??Can ChatGPT handle the role of an interviewer? I'll let ChatGPT interview me for a Java role

And some more videos from the latest Devoxx Belgium.        

?? Quantum Computing in Java: an exceptionential opportunity By Johan Vos

?? Quantum computers Vs modern cryptography By Kristof Verslype

?? Building and Deploying Java Client Desktop Applications With JDK 21 and Beyond By Kevin Rushforth

?? Beyond Logs: Real Time Anomaly Detection without Migraines By Fawaz Ghali

?? SIMD Parallel Programming with the Vector API By Jose? Paumard

??Semantic Kernel: AI orchestration for intelligent apps By Bruno Borges, John Oliver


?? Off-top

How often do our dear readers think about the Roman Empire? If you think the editorial staff is a bit quirky (yes, you are right) and wonder why all the numerals in this issue are Roman, here is a video with a timecode:

Programming's Greatest Mistakes ? Mark Rendle ? GOTO 2023

And we are very sorry that we came across this diamond that late.


We are going on a short (or not so short) break! Expect the new issue in February MMXXIV.

This issue was brought to you by the Avenga team:

要查看或添加评论,请登录

Andrew Petryk的更多文章

社区洞察

其他会员也浏览了