<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Archives des actuator - ji-ka</title>
	<atom:link href="https://www.ji-ka.tn/tag/actuator/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.ji-ka.tn/tag/actuator/</link>
	<description></description>
	<lastBuildDate>Sat, 14 Dec 2024 12:06:11 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>

<image>
	<url>https://www.ji-ka.tn/wp-content/uploads/2023/10/cropped-icon-32x32.png</url>
	<title>Archives des actuator - ji-ka</title>
	<link>https://www.ji-ka.tn/tag/actuator/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Développer un Plugin Maven</title>
		<link>https://www.ji-ka.tn/create-maven-plugin/</link>
		
		<dc:creator><![CDATA[Jihed Kaouech]]></dc:creator>
		<pubDate>Sat, 14 Dec 2024 12:01:55 +0000</pubDate>
				<category><![CDATA[spring]]></category>
		<category><![CDATA[actuator]]></category>
		<category><![CDATA[maven]]></category>
		<guid isPermaLink="false">https://www.ji-ka.tn/?p=1199</guid>

					<description><![CDATA[<p>Maven est un outil puissant d&#8217;automatisation de la construction utilisé principalement pour les projets Java. Une caractéristique clé de Maven est son extensibilité via des plugins, qui permettent de personnaliser et d&#8217;améliorer le processus de construction. Dans ce guide, vous apprendrez à créer un plugin Maven personnalisé. Prérequis Avant de commencer, assurez-vous d&#8217;avoir : Étape [&#8230;]</p>
<p>L’article <a href="https://www.ji-ka.tn/create-maven-plugin/">Développer un Plugin Maven</a> est apparu en premier sur <a href="https://www.ji-ka.tn">ji-ka</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Maven est un outil puissant d&rsquo;automatisation de la construction utilisé principalement pour les projets Java. Une caractéristique clé de Maven est son extensibilité via des plugins, qui permettent de personnaliser et d&rsquo;améliorer le processus de construction. Dans ce guide, vous apprendrez à créer un plugin Maven personnalisé.</p>



<span id="more-1199"></span>



<h2 class="wp-block-heading">Prérequis</h2>



<p>Avant de commencer, assurez-vous d&rsquo;avoir :</p>



<ul class="wp-block-list">
<li><strong>Java Development Kit (JDK)</strong> installé.</li>



<li><strong>Apache Maven</strong> installé et configuré.</li>



<li>Une connaissance de base des concepts Java et Maven.</li>
</ul>



<h2 class="wp-block-heading">Étape 1 : Configurer le Projet du Plugin</h2>



<p>Pour créer un plugin Maven, commencez par configurer un nouveau projet Maven :</p>



<ol class="wp-block-list">
<li>Ouvrez un terminal ou un IDE et exécutez la commande suivante pour créer une structure de projet :</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-width:calc(1 * 0.6 * 1.125rem);line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="mvn archetype:generate -DgroupId=com.exemple -DartifactId=my-plugin -DarchetypeArtifactId=maven-archetype-plugin -DinteractiveMode=false" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #E6E6E6">mvn archetype:generate </span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">DgroupId</span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6">com.exemple </span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">DartifactId</span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6">my</span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">plugin </span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">DarchetypeArtifactId</span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6">maven</span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">archetype</span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">plugin </span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">DinteractiveMode</span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6">false</span></span></code></pre></div>



<p></p>



<p>Cette commande utilise l&rsquo;archétype de plugin Maven pour générer une structure de base pour votre plugin.</p>



<ol start="2" class="wp-block-list">
<li>Accédez au répertoire du projet généré</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="cd my-plugin" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #E6E6E6">cd my</span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">plugin</span></span></code></pre></div>



<p></p>



<h2 class="wp-block-heading">Étape 2 : Implémenter la Logique du Plugin</h2>



<ol class="wp-block-list">
<li>Localisez la classe principale du plugin sous <code>src/main/java/com/example/MyMojo.java</code>. Cette classe est annotée avec <code>@Mojo</code> et sert de point d&rsquo;entrée pour votre plugin.</li>
</ol>



<ol start="2" class="wp-block-list">
<li>Modifiez la classe <code>MyMojo</code> pour implémenter la fonctionnalité souhaitée. Par exemple :</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="package com.example;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

@Mojo(name = &quot;generatefile&quot;)
public class MyMojo extends AbstractMojo {

    @Parameter(property = &quot;outputDir&quot;, defaultValue = &quot;${project.build.directory}&quot;)
    private File outputDir;

    @Parameter(property = &quot;filename&quot;, defaultValue = &quot;output.txt&quot;)
    private String filename;

    @Parameter(property = &quot;content&quot;, defaultValue = &quot;Hello, Maven Plugin!&quot;)
    private String content;

    public void execute() throws MojoExecutionException {
        File outputFile = new File(outputDir, filename);
        try {
            if (!outputDir.exists()) {
                outputDir.mkdirs();
            }
            try (FileWriter writer = new FileWriter(outputFile)) {
                writer.write(content);
            }
            getLog().info(&quot;Fichier généré à : &quot; + outputFile.getAbsolutePath());
        } catch (IOException e) {
            throw new MojoExecutionException(&quot;Erreur lors de la génération du fichier&quot;, e);
        }
    }
}" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #569CD6">package</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">com.example</span><span style="color: #E6E6E6">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">import</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">org.apache.maven.plugin.AbstractMojo</span><span style="color: #E6E6E6">;</span></span>
<span class="line"><span style="color: #569CD6">import</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">org.apache.maven.plugin.MojoExecutionException</span><span style="color: #E6E6E6">;</span></span>
<span class="line"><span style="color: #569CD6">import</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">org.apache.maven.plugins.annotations.Mojo</span><span style="color: #E6E6E6">;</span></span>
<span class="line"><span style="color: #569CD6">import</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">org.apache.maven.plugins.annotations.Parameter</span><span style="color: #E6E6E6">;</span></span>
<span class="line"><span style="color: #569CD6">import</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">java.io.File</span><span style="color: #E6E6E6">;</span></span>
<span class="line"><span style="color: #569CD6">import</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">java.io.FileWriter</span><span style="color: #E6E6E6">;</span></span>
<span class="line"><span style="color: #569CD6">import</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">java.io.IOException</span><span style="color: #E6E6E6">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E6E6E6">@</span><span style="color: #4EC9B0">Mojo</span><span style="color: #E6E6E6">(name </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #CE9178">&quot;generatefile&quot;</span><span style="color: #E6E6E6">)</span></span>
<span class="line"><span style="color: #569CD6">public</span><span style="color: #E6E6E6"> </span><span style="color: #569CD6">class</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">MyMojo</span><span style="color: #E6E6E6"> </span><span style="color: #569CD6">extends</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">AbstractMojo</span><span style="color: #E6E6E6"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E6E6E6">    @</span><span style="color: #4EC9B0">Parameter</span><span style="color: #E6E6E6">(property </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #CE9178">&quot;outputDir&quot;</span><span style="color: #E6E6E6">, defaultValue </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #CE9178">&quot;${project.build.directory}&quot;</span><span style="color: #E6E6E6">)</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">private</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">File</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">outputDir</span><span style="color: #E6E6E6">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E6E6E6">    @</span><span style="color: #4EC9B0">Parameter</span><span style="color: #E6E6E6">(property </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #CE9178">&quot;filename&quot;</span><span style="color: #E6E6E6">, defaultValue </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #CE9178">&quot;output.txt&quot;</span><span style="color: #E6E6E6">)</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">private</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">String</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">filename</span><span style="color: #E6E6E6">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E6E6E6">    @</span><span style="color: #4EC9B0">Parameter</span><span style="color: #E6E6E6">(property </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #CE9178">&quot;content&quot;</span><span style="color: #E6E6E6">, defaultValue </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #CE9178">&quot;Hello, Maven Plugin!&quot;</span><span style="color: #E6E6E6">)</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">private</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">String</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">content</span><span style="color: #E6E6E6">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">public</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">void</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">execute</span><span style="color: #E6E6E6">() </span><span style="color: #569CD6">throws</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">MojoExecutionException</span><span style="color: #E6E6E6"> {</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #4EC9B0">File</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">outputFile</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #C586C0">new</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">File</span><span style="color: #E6E6E6">(outputDir, filename);</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #C586C0">try</span><span style="color: #E6E6E6"> {</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #C586C0">if</span><span style="color: #E6E6E6"> (</span><span style="color: #D4D4D4">!</span><span style="color: #9CDCFE">outputDir</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">exists</span><span style="color: #E6E6E6">()) {</span></span>
<span class="line"><span style="color: #E6E6E6">                </span><span style="color: #9CDCFE">outputDir</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">mkdirs</span><span style="color: #E6E6E6">();</span></span>
<span class="line"><span style="color: #E6E6E6">            }</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #C586C0">try</span><span style="color: #E6E6E6"> (</span><span style="color: #4EC9B0">FileWriter</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">writer</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #C586C0">new</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">FileWriter</span><span style="color: #E6E6E6">(outputFile)) {</span></span>
<span class="line"><span style="color: #E6E6E6">                </span><span style="color: #9CDCFE">writer</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">write</span><span style="color: #E6E6E6">(content);</span></span>
<span class="line"><span style="color: #E6E6E6">            }</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #DCDCAA">getLog</span><span style="color: #E6E6E6">().</span><span style="color: #DCDCAA">info</span><span style="color: #E6E6E6">(</span><span style="color: #CE9178">&quot;Fichier généré à : &quot;</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">+</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">outputFile</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">getAbsolutePath</span><span style="color: #E6E6E6">());</span></span>
<span class="line"><span style="color: #E6E6E6">        } </span><span style="color: #C586C0">catch</span><span style="color: #E6E6E6"> (</span><span style="color: #4EC9B0">IOException</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">e</span><span style="color: #E6E6E6">) {</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #C586C0">throw</span><span style="color: #E6E6E6"> </span><span style="color: #C586C0">new</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">MojoExecutionException</span><span style="color: #E6E6E6">(</span><span style="color: #CE9178">&quot;Erreur lors de la génération du fichier&quot;</span><span style="color: #E6E6E6">, e);</span></span>
<span class="line"><span style="color: #E6E6E6">        }</span></span>
<span class="line"><span style="color: #E6E6E6">    }</span></span>
<span class="line"><span style="color: #E6E6E6">}</span></span></code></pre></div>



<p></p>



<p>Dans cet exemple, le plugin définit une tâche nommée <code>generatefile</code> qui génère un fichier texte avec le contenu spécifié. Les utilisateurs peuvent personnaliser le répertoire de sortie, le nom du fichier et le contenu à l&rsquo;aide des paramètres du plugin.</p>



<ol start="1" class="wp-block-list">
<li></li>
</ol>



<h2 class="wp-block-heading">Étape 3 : Construire et Tester le Plugin</h2>



<ol class="wp-block-list">
<li>Construisez le projet du plugin en exécutant</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="mvn clean install" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #E6E6E6">mvn </span><span style="color: #C586C0">clean</span><span style="color: #E6E6E6"> install</span></span></code></pre></div>



<p></p>



<p>Cette commande compile le plugin et l&rsquo;installe dans votre dépôt Maven local.</p>



<ol start="2" class="wp-block-list">
<li>Pour tester le plugin, créez un projet Maven simple et ajoutez la configuration suivante à son fichier <code>pom.xml</code> :</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;groupId&gt;com.example&lt;/groupId&gt;
            &lt;artifactId&gt;my-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
            &lt;configuration&gt;
                &lt;outputDir&gt;${project.build.directory}/custom-dir&lt;/outputDir&gt;
                &lt;filename&gt;custom-file.txt&lt;/filename&gt;
                &lt;content&gt;Ceci est un fichier généré sur mesure.&lt;/content&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">build</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">plugins</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">plugin</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">com.example</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">my-plugin</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">version</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">1.0-SNAPSHOT</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">version</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">configuration</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">outputDir</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">${project.build.directory}/custom-dir</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">outputDir</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">filename</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">custom-file.txt</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">filename</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">content</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">Ceci est un fichier généré sur mesure.</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">content</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">configuration</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">plugin</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">plugins</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">build</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p></p>



<ol start="3" class="wp-block-list">
<li>Exécutez le plugin avec la commande :</li>
</ol>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="mvn com.example:my-plugin:1.0-SNAPSHOT:generatefile" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #E6E6E6">mvn com.example:my</span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">plugin:</span><span style="color: #B5CEA8">1.0</span><span style="color: #D4D4D4">-</span><span style="color: #E6E6E6">SNAPSHOT:generatefile</span></span></code></pre></div>



<p></p>



<p>Vous devriez voir un message indiquant l&#8217;emplacement du fichier. Vérifiez que le fichier est créé avec le contenu spécifié.</p>



<h2 class="wp-block-heading">Étape 4 : Personnaliser et Étendre</h2>



<p>Vous pouvez améliorer votre plugin en ajoutant plus de tâches, de paramètres et de dépendances. Voici quelques conseils :</p>



<ul class="wp-block-list">
<li><strong>Ajouter Plusieurs Tâches</strong> : Définissez plusieurs classes annotées avec <code>@Mojo</code>, chacune implémentant une tâche différente.</li>



<li><strong>Accéder aux Détails du Projet</strong> : Utilisez l&rsquo;annotation <code>@Parameter</code> pour injecter les détails du projet Maven, tels que les dépendances et les répertoires de construction.</li>



<li><strong>Inclure des Dépendances</strong> : Ajoutez des dépendances dans le fichier <code>pom.xml</code> de votre plugin pour réutiliser des bibliothèques existantes.</li>
</ul>



<h2 class="wp-block-heading">Étape 5 : Publier le Plugin (Optionnel)</h2>



<p>Pour rendre votre plugin disponible à d&rsquo;autres développeurs, envisagez de le publier dans un dépôt Maven. Mettez à jour le fichier <code>pom.xml</code> avec les paramètres de gestion de distribution et déployez le plugin en exécutant :</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.5rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="mvn deploy" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #E6E6E6">mvn deploy</span></span></code></pre></div>



<p></p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>Créer un plugin Maven personnalisé peut considérablement simplifier vos processus de construction et ajouter des fonctionnalités précieuses à vos projets. En suivant ce guide, vous pouvez construire, tester et étendre votre plugin facilement. Explorez la documentation Maven pour découvrir des fonctionnalités avancées et des meilleures pratiques.</p>



<h2 class="wp-block-heading">Code source</h2>



<p>L’exemple complet de ce tutorial est disponible sur&nbsp;<a href="https://github.com/JKaouech/spring-boot/tree/master/dependencies-actuator-maven-plugin">GitHub</a></p>
<p>L’article <a href="https://www.ji-ka.tn/create-maven-plugin/">Développer un Plugin Maven</a> est apparu en premier sur <a href="https://www.ji-ka.tn">ji-ka</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Spring boot actuator</title>
		<link>https://www.ji-ka.tn/spring-boot-actuator/</link>
					<comments>https://www.ji-ka.tn/spring-boot-actuator/#respond</comments>
		
		<dc:creator><![CDATA[Jihed Kaouech]]></dc:creator>
		<pubDate>Sat, 30 Sep 2023 09:20:12 +0000</pubDate>
				<category><![CDATA[spring boot]]></category>
		<category><![CDATA[actuator]]></category>
		<guid isPermaLink="false">http://jikatnr.cluster028.hosting.ovh.net/?p=19</guid>

					<description><![CDATA[<p>In this article, we introduce the Spring Boot Actuator, take a look at how to customize the Spring Boot Actuators’&#160;/info&#160;endpoint and &#160;how to track and monitor this startup information. 1 Actuator Actuator endpoints let you monitor and interact with your Spring Boot application. 1.1 Setup By adding the following dependency to your project:&#160; the actuator [&#8230;]</p>
<p>L’article <a href="https://www.ji-ka.tn/spring-boot-actuator/">Spring boot actuator</a> est apparu en premier sur <a href="https://www.ji-ka.tn">ji-ka</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In this article, we introduce the Spring Boot Actuator, take a look at how to customize the Spring Boot Actuators’&nbsp;<em>/info</em>&nbsp;endpoint and &nbsp;how to track and monitor this startup information.</p>



<span id="more-19"></span>



<h3 class="wp-block-heading" id="user-content-1--actuator"><strong>1 Actuator</strong></h3>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:0;margin-bottom:0"/>



<p>Actuator endpoints let you monitor and interact with your Spring Boot application.</p>



<h4 class="wp-block-heading" id="user-content-11-setup"><strong>1.1 Setup</strong></h4>



<p>By adding the following dependency to your project:&nbsp;</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="&lt;dependencies&gt;
	&lt;dependency&gt;
		&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
		&lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
	&lt;/dependency&gt;
	&lt;dependency&gt;
		&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
		&lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
	&lt;/dependency&gt;
&lt;/dependencies&gt;" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">dependencies</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">org.springframework.boot</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">spring-boot-starter-web</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">	</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">	</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">org.springframework.boot</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #808080">&lt;</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">spring-boot-starter-actuator</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">	</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">dependencies</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p>the actuator endpoints will become available in your project. :&nbsp;<a href="http://localhost:8080/actuator">http://localhost:8080/actuator</a></p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Be aware that all actuators except for&nbsp;<code>/health</code>&nbsp;are disabled by default for security reasons. They might expose sensitive information. You can use the&nbsp;<code>management.endpoints.web.exposure.include</code>&nbsp;property to enable the actuators.</p>
</blockquote>



<p>To expose all actuator endpoint : </p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="management:
  endpoints:
    web:
      exposure:
        include: '*'" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #569CD6">management</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #569CD6">endpoints</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">web</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">      </span><span style="color: #569CD6">exposure</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #569CD6">include</span><span style="color: #E6E6E6">: </span><span style="color: #CE9178">&#39;*&#39;</span></span></code></pre></div>



<p>**To expose only info actuator endpoint : </p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="management:
  endpoints:
    web:
      exposure:
        include: &quot;info&quot;" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #569CD6">management</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #569CD6">endpoints</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">web</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">      </span><span style="color: #569CD6">exposure</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #569CD6">include</span><span style="color: #E6E6E6">: </span><span style="color: #CE9178">&quot;info&quot;</span></span></code></pre></div>



<p>You can reach the info actuator on your local machine:&nbsp;<a href="http://localhost:8080/actuator/info">http://localhost:8080/actuator/info</a>&nbsp;once you start your Spring Boot application.</p>



<h4 class="wp-block-heading" id="user-content-12-spring-boot-info-actuator-contributors"><strong>1.2 Spring Boot info actuator contributors</strong></h4>



<p>There are different info contributors that “contribute” to the information exposed by the actuator info endpoint:</p>



<ul class="wp-block-list">
<li><strong>build</strong>&nbsp;Enabled by default:&nbsp;<code>true</code>&nbsp;Goal: Exposes build information. Requires: you to generate build information Configuration property:&nbsp;<code>management.info.build.enabled</code></li>



<li><strong>env</strong>&nbsp;Enabled by default:&nbsp;<code>false</code>&nbsp;(since Spring Boot 2.6. For the older Spring Boot version, this contributor is enabled by default!) Goal: Exposes any property from the SpringEnvironment . Required: to specify properties with names that start with info.* in you application.yml or application.properties Configuration property:&nbsp;<code>management.info.env.enabled</code></li>



<li><strong>git</strong>&nbsp;Enabled by default:&nbsp;<code>true</code>&nbsp;Goal: exposes git information. Requires: you to generate&nbsp;<a href="https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.build.generate-git-info">git information</a>&nbsp;Configuration property:&nbsp;<code>management.info.git.enabled</code></li>



<li><strong>java</strong>&nbsp;Enabled by default:&nbsp;<code>false</code>&nbsp;(since Spring Boot 2.6) Goal: exposes Java runtime information. Configuration property:&nbsp;<code>management.info.java.enabled</code></li>
</ul>



<h4 class="wp-block-heading" id="static-properties-in-info"><strong>1.3 Static Properties in /info</strong></h4>



<p>You can customize the environment info contributor by adding&nbsp;<code>info.*</code>properties to your application.yml or application.properties :</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="management.info:
  env.enabled: true
info:
  application:
    name: ${spring.application.name}
    description: spring actuator application
    version: '@project.version@'" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #569CD6">management.info</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #569CD6">env.enabled</span><span style="color: #E6E6E6">: </span><span style="color: #569CD6">true</span></span>
<span class="line"><span style="color: #569CD6">info</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #569CD6">application</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">name</span><span style="color: #E6E6E6">: </span><span style="color: #CE9178">${spring.application.name}</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">description</span><span style="color: #E6E6E6">: </span><span style="color: #CE9178">spring actuator application</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">version</span><span style="color: #E6E6E6">: </span><span style="color: #CE9178">&#39;@project.version@&#39;</span></span></code></pre></div>



<h4 class="wp-block-heading" id="git-details-in-info"><strong>1.4 GIT details in /info</strong></h4>



<p>We can add git details using the respective Maven dependency:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="&lt;dependency&gt;
    &lt;groupId&gt;pl.project13.maven&lt;/groupId&gt;
    &lt;artifactId&gt;git-commit-id-plugin&lt;/artifactId&gt;
&lt;/dependency&gt;" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">pl.project13.maven</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">git-commit-id-plugin</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p>and enable management.info.git in configuration property:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="management.info:
 git.enabled: true" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #569CD6">management.info</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6"> </span><span style="color: #569CD6">git.enabled</span><span style="color: #E6E6E6">: </span><span style="color: #569CD6">true</span></span></code></pre></div>



<h4 class="wp-block-heading" id="git-build-information-details-in-info"><strong>1.5 GIT build information details in /info</strong></h4>



<p>We can also include build information including name, group, and version using the Maven plugin:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="<plugin&gt;
    <groupId&gt;org.springframework.boot</groupId&gt;
    <artifactId&gt;spring-boot-maven-plugin</artifactId&gt;
    <executions&gt;
        <execution&gt;
            <goals&gt;
                <goal&gt;build-info</goal&gt;
            </goals&gt;
        </execution&gt;
    </executions&gt;
</plugin&gt;" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">plugin</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">org.springframework.boot</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">spring-boot-maven-plugin</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">executions</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">execution</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">goals</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">                </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">goal</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">build-info</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">goal</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">            </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">goals</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">execution</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">executions</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">plugin</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<p>and enable management.info.build in configuration property:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="management.info:
 build.enabled: true" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #569CD6">management.info</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6"> </span><span style="color: #569CD6">build.enabled</span><span style="color: #E6E6E6">: </span><span style="color: #569CD6">true</span></span></code></pre></div>



<h3 class="wp-block-heading" id="startup-tracking"><strong>2 Startup Tracking</strong></h3>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:0;margin-bottom:0"/>



<p>Tracking the various steps during application startup can provide useful information that can help us to understand the time spent during various phases of application startup. Such instrumentation can also improve our understanding of the context lifecycle and the application startup sequence.</p>



<h4 class="wp-block-heading" id="setup-1"><strong>2.1 Setup</strong></h4>



<ul class="wp-block-list">
<li>Add the spring-boot-starter-actuator dependency to our POM</li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="<dependencies&gt;
  <dependency&gt;
    <groupId&gt;org.springframework.boot</groupId&gt;
    <artifactId&gt;spring-boot-starter-web</artifactId&gt;
  </dependency&gt;
  <dependency&gt;
    <groupId&gt;org.springframework.boot</groupId&gt;
    <artifactId&gt;spring-boot-starter-actuator</artifactId&gt;
  </dependency&gt;
</dependencies&gt;" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #808080">&lt;</span><span style="color: #569CD6">dependencies</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">org.springframework.boot</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">spring-boot-starter-web</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">org.springframework.boot</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">groupId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #808080">&lt;</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span><span style="color: #E6E6E6">spring-boot-starter-actuator</span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">artifactId</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #808080">&lt;/</span><span style="color: #569CD6">dependency</span><span style="color: #808080">&gt;</span></span>
<span class="line"><span style="color: #808080">&lt;/</span><span style="color: #569CD6">dependencies</span><span style="color: #808080">&gt;</span></span></code></pre></div>



<ul class="wp-block-list">
<li>Expose the required endpoint over HTTP by setting the configuration property in our application properties file:</li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="management:
  endpoints:
    web:
      exposure:
        include: &quot;startup&quot;" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #569CD6">management</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #569CD6">endpoints</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #569CD6">web</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">      </span><span style="color: #569CD6">exposure</span><span style="color: #E6E6E6">:</span></span>
<span class="line"><span style="color: #E6E6E6">        </span><span style="color: #569CD6">include</span><span style="color: #E6E6E6">: </span><span style="color: #CE9178">&quot;startup&quot;</span></span></code></pre></div>



<h4 class="wp-block-heading" id="startup-endpoint"><strong>2.2 Startup Endpoint</strong></h4>



<p>We need to set the application&rsquo;s startup configuration to an instance of `BufferingApplicationStartup`. This is an in-memory implementation of the `ApplicationStartup` interface provided by Spring Boot. It captures the events during Spring&rsquo;s startup process and stores them in an internal buffer.</p>



<ul class="wp-block-list">
<li>Create a simple application with this implementation:</li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="@SpringBootApplication
public class SpringActuatorApplication {
  public static void main(String[] args) {
    SpringApplication app = new SpringApplication(SpringActuatorApplication.class);
    app.setApplicationStartup(new BufferingApplicationStartup(2048));
    app.run(args);
  }
}" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #E6E6E6">@</span><span style="color: #4EC9B0">SpringBootApplication</span></span>
<span class="line"><span style="color: #569CD6">public</span><span style="color: #E6E6E6"> </span><span style="color: #569CD6">class</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">SpringActuatorApplication</span><span style="color: #E6E6E6"> {</span></span>
<span class="line"><span style="color: #E6E6E6">  </span><span style="color: #569CD6">public</span><span style="color: #E6E6E6"> </span><span style="color: #569CD6">static</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">void</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">main</span><span style="color: #E6E6E6">(</span><span style="color: #4EC9B0">String</span><span style="color: #E6E6E6">[] </span><span style="color: #9CDCFE">args</span><span style="color: #E6E6E6">) {</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #4EC9B0">SpringApplication</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">app</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #C586C0">new</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">SpringApplication</span><span style="color: #E6E6E6">(</span><span style="color: #9CDCFE">SpringActuatorApplication</span><span style="color: #E6E6E6">.</span><span style="color: #9CDCFE">class</span><span style="color: #E6E6E6">);</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #9CDCFE">app</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">setApplicationStartup</span><span style="color: #E6E6E6">(</span><span style="color: #C586C0">new</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">BufferingApplicationStartup</span><span style="color: #E6E6E6">(</span><span style="color: #B5CEA8">2048</span><span style="color: #E6E6E6">));</span></span>
<span class="line"><span style="color: #E6E6E6">    </span><span style="color: #9CDCFE">app</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">run</span><span style="color: #E6E6E6">(args);</span></span>
<span class="line"><span style="color: #E6E6E6">  }</span></span>
<span class="line"><span style="color: #E6E6E6">}</span></span></code></pre></div>



<ul class="wp-block-list">
<li>Now, we can start our application and query the startup actuator endpoint.&nbsp;<a href="http://localhost:8080/actuator/startup">http://localhost:8080/actuator/startup</a></li>
</ul>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Be aware before spring boot version 2.6 startup endpoint only allow POST method call.</p>
</blockquote>



<h4 class="wp-block-heading" id="filtering-startup-events"><strong>2.3 Filtering Startup Events</strong></h4>



<p>The buffering implementation has a fixed capacity for storing events in memory. Therefore, it might not be desirable to store a large number of events in the buffer.</p>



<p>We can filter the instrumented events and only store those that may be of interest to us:</p>



<div class="wp-block-kevinbatdorf-code-block-pro" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span role="button" tabindex="0" data-code="	public static void main(String[] args) {
		SpringApplication app = new SpringApplication(SpringActuatorApplication.class);
		BufferingApplicationStartup startup = new BufferingApplicationStartup(2048);
		startup.addFilter(startupStep -&gt; startupStep.getName().matches(&quot;spring.boot.application.starting&quot;));
		app.setApplicationStartup(startup);
		app.run(args);
	}" style="color:#E6E6E6;display:none" aria-label="Copy" class="code-block-pro-copy-button"><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki slack-dark" style="background-color: #222222" tabindex="0"><code><span class="line"><span style="color: #E6E6E6">	</span><span style="color: #569CD6">public</span><span style="color: #E6E6E6"> </span><span style="color: #569CD6">static</span><span style="color: #E6E6E6"> </span><span style="color: #4EC9B0">void</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">main</span><span style="color: #E6E6E6">(</span><span style="color: #4EC9B0">String</span><span style="color: #E6E6E6">[] args) {</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #4EC9B0">SpringApplication</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">app</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #C586C0">new</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">SpringApplication</span><span style="color: #E6E6E6">(</span><span style="color: #9CDCFE">SpringActuatorApplication</span><span style="color: #E6E6E6">.</span><span style="color: #9CDCFE">class</span><span style="color: #E6E6E6">);</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #4EC9B0">BufferingApplicationStartup</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">startup</span><span style="color: #E6E6E6"> </span><span style="color: #D4D4D4">=</span><span style="color: #E6E6E6"> </span><span style="color: #C586C0">new</span><span style="color: #E6E6E6"> </span><span style="color: #DCDCAA">BufferingApplicationStartup</span><span style="color: #E6E6E6">(</span><span style="color: #B5CEA8">2048</span><span style="color: #E6E6E6">);</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #9CDCFE">startup</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">addFilter</span><span style="color: #E6E6E6">(startupStep </span><span style="color: #569CD6">-&gt;</span><span style="color: #E6E6E6"> </span><span style="color: #9CDCFE">startupStep</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">getName</span><span style="color: #E6E6E6">().</span><span style="color: #DCDCAA">matches</span><span style="color: #E6E6E6">(</span><span style="color: #CE9178">&quot;spring.boot.application.starting&quot;</span><span style="color: #E6E6E6">));</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #9CDCFE">app</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">setApplicationStartup</span><span style="color: #E6E6E6">(startup);</span></span>
<span class="line"><span style="color: #E6E6E6">		</span><span style="color: #9CDCFE">app</span><span style="color: #E6E6E6">.</span><span style="color: #DCDCAA">run</span><span style="color: #E6E6E6">(args);</span></span>
<span class="line"><span style="color: #E6E6E6">	}</span></span></code></pre></div>



<p>Here, we&rsquo;ve used the addFilter method to only instrument steps with the specified name.</p>



<h3 class="wp-block-heading" id="user-content-4-source-code"><strong>3 Source code</strong></h3>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:0;margin-bottom:0"/>



<p>The complete source code of this article can be found&nbsp;<a href="https://github.com/JKaouech/spring-boot/tree/master/spring-actuator">over on GitHub.</a></p>



<h3 class="wp-block-heading" id="user-content-reference"><strong>Reference</strong></h3>



<hr class="wp-block-separator has-alpha-channel-opacity is-style-wide" style="margin-top:0;margin-bottom:0"/>



<p><a href="https://www.baeldung.com/spring-boot-actuators">https://www.baeldung.com/spring-boot-actuators</a></p>



<p><a href="https://www.baeldung.com/spring-boot-info-actuator-custom">https://www.baeldung.com/spring-boot-info-actuator-custom</a></p>



<p><a href="https://medium.com/@TimvanBaarsen/help-my-spring-boot-info-actuator-endpoint-is-enabled-but-i-dont-see-any-environment-details-c2d41a7b24d7">https://medium.com/@TimvanBaarsen/help-my-spring-boot-info-actuator-endpoint-is-enabled-but-i-dont-see-any-environment-details-c2d41a7b24d7</a></p>



<p><a href="https://www.baeldung.com/spring-boot-actuator-startup">https://www.baeldung.com/spring-boot-actuator-startup</a></p>



<p><a href="https://medium.com/techwasti/startup-actuator-endpoint-spring-boot-54a8dd0a1fdb">https://medium.com/techwasti/startup-actuator-endpoint-spring-boot-54a8dd0a1fdb</a></p>
<p>L’article <a href="https://www.ji-ka.tn/spring-boot-actuator/">Spring boot actuator</a> est apparu en premier sur <a href="https://www.ji-ka.tn">ji-ka</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.ji-ka.tn/spring-boot-actuator/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
