Java Digest # 10

Java Digest # 10

Hello everybody! 👋 👋 👋 We are Tinkoff Java developers: Andriy Orlov, Arseniy Zaitsev, Konstantin Maksimovand Konstantin Polshchikov. We collect interesting news, articles, tutorials and other materials from the world of Java development and decided to share it not only with colleagues, but also with the entire community.

🌼In this spring period full of freshness and updates, stay tuned for reviews of the state of jextract and new terminal features in JetBrains IDEs, including its beta version. Get ready for Spring AI version 0.8.0 with new features and improvements. Breathe in the fragrance of blooming spring as we dive into the various Java Enhancement Proposals (JEPs), including Markdown support in JavaDoc, new capabilities for compiling and executing Java code, and a preview of Java 22 features. Get inspired, it’s spring in the Java world brings with it renewal and new opportunities for all of us. Stay tuned! 🌼

top news

State of jextract. Jextract is a tool for converting C code to Java code that supports various aspects of C++. Jextract provides facilities for converting data types, including function pointers and function variables. The report for February 2024 is all about how this tool has changed and what is new in it.

The New Terminal (Beta) is Now in JetBrains IDEs. JetBrains has introduced a beta of a new terminal for their IDE. It will be fully available in 2024.1, but it can already be touched by enabling the appropriate setting. The new terminal provides many interesting features: auto-completion, improved command history and visual division of commands into separate blocks, between which it is easy to navigate. It looks really nice.

Spring AI 0.8.0 Released. Spring AI version 0.8.0 has been released. The project aims to simplify the creation of applications that use ChatGPT and other AI models that provide APIs for interaction. The developers of Spring AI want to provide abstractions for working with all the underlying models so that it is easy to switch between them with minimal code change. This version features the following functionality:

  • API for interaction with AI models from various providers: OpenAI, Microsoft, Amazon, Google, Huggingface and others;

  • support for the Vector Store API, which provides an interface for interacting with vector databases, 8 different databases are supported;

  • calling functions – blocks of code in II-models, a feature for Open AI;

  • autoconfiguration and Spring Boot starters for AI models and vector stores;

  • ETL framework for Data Engineering.

JEP 467: Markdown Documentation Comments – JEP 467 on Markdown JavaDoc has moved to Candidate status.

Interesting videos

Project Leyden: Capturing Lightning in a Bottle. The Laden project aims to cut application launch times in half and by an order of magnitude in the future. Java library developers at Oracle participate in the project. The report will tell and show how you can optimize the start of the program by 800%(!), using Laden.

Java’s Custom Runtime Builder – jlink. JLink is a command-line tool for creating your own Java runtime image. It uses two options: adding modules and defining the source image. JLink allows you to create runtime images containing only the necessary modules, which reduces the size of the image and speeds up the application startup. Learn more about this tool in the video.

Oleksiy Ragozin – Java in a container: features of operation. Very interesting, deeply practical report. The speaker explains what problems can be encountered when running Java applications in containers and how to solve them. At the same time, he does not forget to give a theoretical basis at the beginning for a better understanding of the material. Memory and CPU work are touched upon and there is plenty of additional material to dive deeper into the topic.

Data Oriented Programming in Java 21, Solving the Countdown Game – JEP Cafe #22. Video – half an hour of pleasure with sophisticated solutions using new Java features aimed at implementing the paradigm of Data-oriented programming. Sealed classes, records, pattern matching, unnamed patterns, gassers for the Stream API, Exhaustive Switch – these are used to demonstrate good solutions to the Countdown problem. Such a visual demonstration is worth admiring!

Java 22 Previews Statements Before super(...) and this(...) – Inside Java Newscast #62. JEP 447 was included as a preview in Java 22, which partially removes the prohibition of code before calling this() and super() in constructors. In this video, Mykola explains why the ban was introduced in the first place, what code we can now write and why is this possibly necessary?

Does Java 22 Kill Build Tools? – Inside Java Newscast #63. Maven and Gradle are no longer needed. Java 22 introduced JEP 458, which essentially continues the idea of ​​JEP 330: it makes it possible to compile and run Java code with a single java command. But if it used to be about one file, now Java will find all class files and even grinders necessary to compile and run the program. Mykola tells how it works, what are the pitfalls and, most importantly, why it is needed.

Dmytro Tuchs – The art of JUnit extensions. “Extension is not an analogue of @ BeforeEach / All” – the quote perfectly conveys the essence of the report. The speaker demonstrates the power of the Extensions engine introduced in JUnit 5 using OAuth 2 authorization as an example. If you’re still using inheritance in your test classes, this talk is a must-watch because 99% of the time you don’t actually need inheritance and your extension.

Foreign Function & Memory API – A (Quick) Peek Under the Hood. A good talk in which the author talks about modern, efficient and secure access to native code from Java through the Foreign Function & Memory API, and how it is better than the already existing JNI.

Useful articles

Using resilience4j with Spring Boot. Resilience4j is a library that provides a set of tools for increasing the reliability and fault tolerance of Java applications primarily in microservice architecture. The article breaks down the main components with examples and how they can help in development.

Hexagonal architecture and Spring Boot. IN The usual structure of a Java project on spring boot is problems with the arrangement of classes and complexity of understanding. Hexagonal architecture offers separation of boring code from logic and loose coupling. Read more about how it will look on spring boot in the article.

Hibernate StatelessSession JDBC Batching a story about StatelessSession, which has existed in Hibernate for more than a decade, but got new uses in Hibernate 6. It can now be used to create batch INSERT, DELETE, and UPDATE queries.

Optimizing Java for Modern Hardware: Continuous Evolution of Vector API. A short article that simply explains what the Vector API is, why it gives you a performance boost, and a simple example of how to use it.

Myths and realities of “Multimaster” in the PostgreSQL DBMS architecture a cycle of articles in which the problems and the solved task are academically described. In the first part – General concepts of multimaster. In the second part the focus shifts to the guarantee of consistency and resolution of conflicts in the multimaster, and in the third part performance is talked about. Recommended for reading.

The Billion Row Challenge (1BRC) – Step-by-step from 71s to 1.7s. In the article, the author tells how he participated in The Billion Row Challenge. The task of the test was to write a program that calculates the minimum, average and maximum temperature for each weather station. The main difficulty is that this data lies in a file containing a billion lines. The article briefly describes profiling tools and details various methods of Java optimization, both safe and not so.

A selection of interesting things

Setting up CI/CD through the eyes of a developer. Being able to configure CI/CD may not be the most frequently used skill of a Java developer, but it’s still very useful. The article describes the process of creating a CI/CD for a Java project using Docker and is designed as a step-by-step guide, which is useful when you want to try something in a pet project with minimal CI.

Speed ​​up your Java Development on Windows with Dev Drive Microsoft talked about Dev Drive. Dev Drive is a new solution built on the Resilient File System (ReFS) and designed to increase development speed by optimizing the file system. The article describes how to create it, there is an example from Spring Pet Clinic sample application. It was possible to speed up the compilation through maven from 2 minutes to 45 seconds.

SberTech invites developers to test its GitHub counterpart – the GitVerse web service. SberTech has released a Russian analogue of GitHub. It is difficult to comment on this. It is better to go and see and try.

Podlodka Java Crew – Another Podlodka Java Crew will start on March 11, where integrations will be discussed all week. The topic is as practical and applied as possible. We stock up on popcorn and run for tickets.

Thank you for reading! See you in a month 😉

Send materials if you come across something interesting, and we will publish it in the next issue and thank you!

Related posts