Articles

Utiliser les fonctionnalités de prévisualisation JDK21 et/ou les classes incubatrices

Découvrez comment tirer le meilleur parti des fonctionnalités de prévisualisation JDK21 et des classes incubatrices pour améliorer votre code Java.

Comment configurer votre build Maven pour prendre en charge une leçon de jeu avec les nouvelles fonctionnalités de JDK21 (ou même plus récentes) comme les fonctionnalités d’aperçu et peut-être certaines classes de l’incubateur ? C’est plus facile que vous ne le pensez. Commençons la configuration. Je suppose que vous souhaitez jouer avec les fonctionnalités d’aperçu de JDK21, par exemple les modèles de chaînes (JEP430). Je viens de sélectionner ce JEP pour la démonstration. Vous pouvez sélectionner n’importe quel JEP en aperçu. La première chose à savoir est que vous devez activer les fonctionnalités d’aperçu via :

Parfois, vous souhaitez jouer avec les nouvelles fonctionnalités de JDK21 (ou même des JDK plus récents) comme les fonctionnalités de prévisualisation et peut-être certaines classes de l’incubateur. Alors, comment pouvez-vous configurer votre build Maven pour prendre en charge une telle leçon de jeu? C’est plus facile que vous ne le pensez. Commençons la configuration. Mon hypothèse est que vous souhaiteriez jouer avec les fonctionnalités de prévisualisation de JDK21, par exemple les modèles de chaîne (JEP430). Je n’ai sélectionné ce JEP que pour la démonstration. Vous pouvez sélectionner n’importe quel JEP en prévisualisation. La première chose à savoir est que vous devez activer les fonctionnalités de prévisualisation via:

XML

org.apache.maven.plugins

maven-compiler-plugin

true

Une fois cette étape terminée, vous pouvez ajouter des dépendances supplémentaires à votre projet pour prendre en charge les fonctionnalités de prévisualisation. Pour le JEP430, vous devez ajouter la dépendance suivante:

XML

org.openjdk.jmh

jmh-core

1.21.0-SNAPSHOT

test

Une fois cette étape terminée, vous pouvez commencer à utiliser les fonctionnalités de prévisualisation dans votre projet. Vous pouvez également utiliser des outils tels que JMH pour mesurer les performances des fonctionnalités de prévisualisation et comparer leurs performances avec les versions stables. Vous pouvez également utiliser des outils tels que JUnit pour tester le comportement des fonctionnalités de prévisualisation et vous assurer qu’elles fonctionnent comme prévu. Enfin, vous pouvez utiliser des outils tels que SonarQube pour surveiller la qualité du code et vous assurer que les fonctionnalités de prévisualisation ne compromettent pas la qualité du code.

Une fois que vous avez configuré votre projet pour prendre en charge les fonctionnalités de prévisualisation, vous pouvez commencer à explorer les données et à tirer parti des nouvelles fonctionnalités. Vous pouvez par exemple analyser les données pour voir comment les nouvelles fonctionnalités affectent les performances ou la qualité du code. Vous pouvez également utiliser des outils tels que Spark ou Hadoop pour traiter et analyser des jeux de données volumineux et tirer des conclusions sur les performances et la qualité des fonctionnalités de prévisualisation. Vous pouvez même créer des modèles d’apprentissage automatique pour prédire le comportement des n

Source de l’article sur DZONE

Ever looked for a comprehensive intro to Maven that is fun and entertaining at the same time? Then have a look at this brand-new episode of the « Marco Codes » YouTube channel: Maven Tutorial – Nice & Easy.

In this video, you’ll learn how to use Maven like a professional: installations, using the mvn wrapper, using Maven together with IDEs, and of course the Maven basics. From pom.xml concepts to running commands (clean install) to understanding Maven repositories and multi-module projects, by the end of it, there won’t be many questions left when it comes to Maven.

Source de l’article sur DZONE

In a previous article, I described a way to organize low-latency products as multiple code bases which are bound together with a Maven Bill of Materials (BOM). Understandably, this requires setting up continuous integration and deployment for a large number of similar projects. Maintaining such a setup manually in the face of change while ensuring its consistency will take a lot of effort.  In this article, I will describe how the team at Chronicle Software has tackled these issues in different projects by writing code that does this for us, in the form of Kotlin DSL for TeamCity.

This guide will show how to configure the same set of CI/CD builds for multiple Maven project repositories of similar layouts programmatically, following the DRY (don’t repeat yourself) principle. Following it will require a base knowledge of git, Maven, and TeamCity but would not require knowledge of the Kotlin language, since all of the displayed code is self-explanatory.

Source de l’article sur DZONE


Infographic.

Add Sleuth, RabbitMQ, and Zipkin in Spring Cloud Project

This article assumes that you know how to set up a spring cloud or spring boot project; also, the RabbitMQ and ElasticSearch servers are ready.

Add the dependencies in maven pom.xml:

Source de l’article sur DZONE

The best way to protect your Java code from avoidable bugs is to use static code analysis tools that can help you find and fix problematic code before it reaches production. Let’s look at some popular static code analysis tools that can be used to test code from a number of different angles.

DeepSource

DeepSource delivers what is probably the best static code analysis you can find for Java. The DeepSource Java analyzer detects 190+ code quality issues, including performance bugs, security risks, bug risks, and anti-patterns. Currently, It supports Gradle Java projects, and in the future, DeepSource will add support for Maven and Android too. DeepSource is also working on bringing Autofix support to the Java analyzer, which will let developers fix issues without writing a single code line.

Source de l’article sur DZONE

Cloud Computing has emerged as a novel technology today. Every company is a software company today, and it is evident that no company can service without using the power of cloud computing. The cloud is seen as a conceptual layer on the Internet, making all available software and hardware resources transparent, rendering them accessible through a well-defined interface. 

As the companies are increasingly relying on these cloud computing services to be always stable and accessible whenever their customers need them, the services and applications’ downtime is highly unacceptable. In this article, we will be discussing the concepts related to high availability (HA), what it is, how it works, and how companies can take advantage of this. 

Source de l’article sur DZONE

In part one, we achieved 100 percent coverage. In this installment, we mutate our code and check how good our tests are.

There are several mutation testing frameworks. In this case, we will use PITEST.

Source de l’article sur DZONE

In this tutorial, we are going to try out a Spring Boot Swagger-enabled REST project and explore how the validation constraints can be utilized automatically for enriching Swagger models.

We are going to refer to https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api and https://spring.io/guides/gs/rest-service/ as starting points.

Source de l’article sur DZONE

Apache Maven is distributed in several formats. The simplest way to install Maven is to download a ready-made binary distribution archive and follow the installation instructions. Maven 3.3+ release requires JDK 1.7 or above to execute

General Requirements

  • Java JDK must be installed on your system.
  • Java 1.7 or higher is needed for Maven.

To verify the Java JDK is properly installed, from your command line, run the following command:

Source de l’article sur DZONE


Introduction

This article is a comprehensive guide, from start to finish, on how to deploy a Java library to Maven Central so everyone can use it by including the dependency in their project(s).

It goes without saying that there has to be a Java library for it to be uploaded. Hence, the first thing is creating a Java library that’s unique, of quality code standard and will be beneficial to the developer community. Of course, you’ve got that already — that’s why you’re reading this after all (or maybe you’re planning on creating one)

Source de l’article sur DZONE