Versione java 21 boot 3,3,13 Batch 5.1.3

This commit is contained in:
Gaetano Savo 2025-09-08 15:22:07 +02:00
parent 17f128deea
commit 471ed1e327
6 changed files with 234 additions and 15 deletions

View File

@ -2,7 +2,7 @@
setlocal
rem Imposta JAVA_HOME
set JAVA_HOME=C:\Dev2012\BUILDERS\java\jdk-17.0.9
set JAVA_HOME=C:\Dev2012\BUILDERS\java\jdk-21.0.6
rem Aggiungi java al PATH
set PATH=%JAVA_HOME%\bin;%PATH%

View File

@ -13,12 +13,12 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<version>3.3.13</version>
<relativePath/>
</parent>
<properties>
<java.version>17</java.version>
<java.version>21</java.version>
</properties>
<dependencies>

BIN
server.log.2025-09-03.0.gz Normal file

Binary file not shown.

View File

@ -15,11 +15,16 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.ResponseEntity;
import org.springframework.boot.SpringBootVersion;
import org.springframework.boot.info.BuildProperties;
import org.springframework.core.SpringVersion;
import java.util.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@RestController
@RequestMapping("/actuator")
@RequestMapping("/api")
public class BatchController {
@Autowired
@ -37,6 +42,9 @@ public class BatchController {
@Autowired
private ApplicationContext applicationContext;
@Autowired(required = false)
private BuildProperties buildProperties;
@SuppressWarnings("null")
@GetMapping("/batch/jobs")
@ -493,4 +501,67 @@ public class BatchController {
return ResponseEntity.internalServerError().body(response);
}
}
/**
* Endpoint per ottenere informazioni di versione e sistema
*/
@GetMapping("/info")
public ResponseEntity<Map<String, Object>> getInfo() {
Map<String, Object> response = new HashMap<>();
try {
// Informazioni di build
Map<String, Object> build = new HashMap<>();
if (buildProperties != null) {
build.put("version", buildProperties.getVersion());
build.put("time", buildProperties.getTime());
build.put("artifact", buildProperties.getArtifact());
build.put("name", buildProperties.getName());
build.put("group", buildProperties.getGroup());
} else {
build.put("version", "1.0.0");
build.put("time", LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
build.put("artifact", "BatchDataProcessing");
build.put("name", "Spring Batch Data Processing");
build.put("group", "com.fideuram.bulk");
}
response.put("build", build);
// Informazioni Java
Map<String, Object> java = new HashMap<>();
java.put("version", System.getProperty("java.version"));
java.put("vendor", System.getProperty("java.vendor"));
java.put("runtime", System.getProperty("java.runtime.name"));
java.put("vm", System.getProperty("java.vm.name"));
response.put("java", java);
// Informazioni Spring
Map<String, Object> spring = new HashMap<>();
spring.put("version", SpringVersion.getVersion());
response.put("spring", spring);
Map<String, Object> boot = new HashMap<>();
boot.put("version", SpringBootVersion.getVersion());
response.put("boot", boot);
Map<String, Object> batch = new HashMap<>();
batch.put("version", SpringBatchVersion.getVersion());
response.put("batch", batch);
// Informazioni applicazione
Map<String, Object> app = new HashMap<>();
app.put("name", "Spring Batch Job Monitor");
app.put("description", "Sistema di monitoraggio e gestione job Spring Batch");
app.put("encoding", System.getProperty("file.encoding"));
app.put("timezone", System.getProperty("user.timezone"));
response.put("app", app);
return ResponseEntity.ok(response);
} catch (Exception e) {
Map<String, Object> errorResponse = new HashMap<>();
errorResponse.put("error", "Errore durante il recupero delle informazioni di sistema: " + e.getMessage());
return ResponseEntity.internalServerError().body(errorResponse);
}
}
}

View File

@ -65,5 +65,5 @@ batch.mail.to=g.savo@armundia.com
# Actuator Configuration per Monitor GUI
management.endpoints.web.exposure.include=health,info,batch
management.endpoint.batch.enabled=true
# Il base-path per gli actuator è stato spostato in Spring Boot 3
management.server.web.base-path=/actuator
# Configurazione corretta per Spring Boot 3
management.endpoints.web.base-path=/actuator

View File

@ -284,12 +284,50 @@
border-left: 4px solid #007bff;
background-color: #f1f3f4;
}
.version-info {
margin-bottom: 20px;
padding: 15px;
background-color: #e9ecef;
border-radius: 5px;
border-left: 4px solid #007bff;
}
.version-info button {
background: none;
border: 1px solid #007bff;
color: #007bff;
padding: 5px 10px;
border-radius: 3px;
cursor: pointer;
font-size: 12px;
}
</style>
</head>
<body>
<div class="container">
<h1>🚀 Spring Batch Job Monitor</h1>
<!-- Sezione informazioni versione -->
<div class="version-info" id="versionInfo" style="margin-bottom: 20px; padding: 15px; background-color: #e9ecef; border-radius: 5px; border-left: 4px solid #007bff;">
<div style="display: flex; justify-content: space-between; align-items: center;">
<div>
<h3 style="margin: 0 0 10px 0; color: #333;">📋 Informazioni Sistema</h3>
<div id="versionDetails" style="display: flex; gap: 30px; flex-wrap: wrap;">
<div>📦 <strong>Applicazione:</strong> <span id="appVersion">Caricamento...</span></div>
<div><strong>Java:</strong> <span id="javaVersion">Caricamento...</span></div>
<div>🍃 <strong>Spring Boot:</strong> <span id="springVersion">Caricamento...</span></div>
<div>🍃 <strong>Boot:</strong> <span id="bootVersion">Caricamento...</span></div>
<div>🍃 <strong>Batch:</strong> <span id="batchVersion">Caricamento...</span></div>
<div>⚙️ <strong>Build:</strong> <span id="buildTime">Caricamento...</span></div>
</div>
</div>
<button onclick="toggleVersionInfo()" id="versionToggle" style="background: none; border: 1px solid #007bff; color: #007bff; padding: 5px 10px; border-radius: 3px; cursor: pointer; font-size: 12px;">
🔽 Nascondi
</button>
</div>
</div>
<div class="controls">
<button id="refreshBtn" onclick="refreshJobs()">🔄 Aggiorna</button>
<button id="autoRefreshBtn" onclick="toggleAutoRefresh()">⏰ Auto-refresh: ON</button>
@ -370,6 +408,9 @@
// Carica i job disponibili
loadAvailableJobs();
// Carica le informazioni di versione
loadVersionInfo();
function refreshJobs() {
const statusLabel = document.getElementById('statusLabel');
const errorMessage = document.getElementById('errorMessage');
@ -378,7 +419,7 @@
statusLabel.textContent = 'Aggiornamento in corso...';
errorMessage.style.display = 'none';
fetch('/actuator/batch/jobs')
fetch('/api/batch/jobs')
.then(response => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
@ -522,7 +563,7 @@
function loadAvailableJobs() {
const container = document.getElementById('availableJobsContainer');
fetch('/actuator/batch/available-jobs')
fetch('/api/batch/available-jobs')
.then(response => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
@ -560,7 +601,7 @@
statusLabel.textContent = `Avvio del job '${jobName}' in corso...`;
errorMessage.style.display = 'none';
fetch(`/actuator/batch/launch/${jobName}`, {
fetch(`/api/batch/launch/${jobName}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@ -597,7 +638,7 @@
statusLabel.textContent = `Arresto del job con ID ${executionId} in corso...`;
errorMessage.style.display = 'none';
fetch(`/actuator/batch/stop/${executionId}`, {
fetch(`/api/batch/stop/${executionId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@ -651,7 +692,7 @@
// Ferma l'auto-refresh
stopAutoRefresh();
fetch('/actuator/server/shutdown', {
fetch('/api/server/shutdown', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@ -717,7 +758,7 @@
statusLabel.textContent = `Cancellazione del job con ID ${executionId} in corso...`;
errorMessage.style.display = 'none';
fetch(`/actuator/batch/delete/${executionId}`, {
fetch(`/api/batch/delete/${executionId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
@ -767,7 +808,7 @@
modalContent.innerHTML = '<p>Caricamento dettagli...</p>';
modal.style.display = 'block';
fetch(`/actuator/batch/job/${executionId}/details`)
fetch(`/api/batch/job/${executionId}/details`)
.then(response => response.json())
.then(data => {
if (data.status === 'success') {
@ -890,11 +931,118 @@
return html;
}
// Carica le informazioni di versione
function loadVersionInfo() {
fetch('/api/info')
.then(response => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
}
return response.json();
})
.then(data => {
updateVersionInfo(data);
})
.catch(error => {
console.error('Errore durante il caricamento delle informazioni di versione:', error);
updateVersionInfo({
error: 'Informazioni non disponibili'
});
});
}
function updateVersionInfo(data) {
const appVersionEl = document.getElementById('appVersion');
const javaVersionEl = document.getElementById('javaVersion');
const springVersionEl = document.getElementById('springVersion');
const bootVersionEl = document.getElementById('bootVersion');
const batchVersionEl = document.getElementById('batchVersion');
const buildTimeEl = document.getElementById('buildTime');
if (data.error) {
appVersionEl.textContent = 'N/A';
javaVersionEl.textContent = 'N/A';
springVersionEl.textContent = 'N/A';
bootVersionEl.textContent = 'N/A';
batchVersionEl.textContent = 'N/A';
buildTimeEl.textContent = 'N/A';
return;
}
// Informazioni applicazione
if (data.build && data.build.version) {
appVersionEl.textContent = data.build.version;
} else if (data.app && data.app.version) {
appVersionEl.textContent = data.app.version;
} else {
appVersionEl.textContent = '1.0.0';
}
// Informazioni Java
if (data.java && data.java.version) {
javaVersionEl.textContent = data.java.version;
} else {
// Fallback usando system properties se disponibili
javaVersionEl.textContent = 'N/A';
}
// Informazioni Spring
if (data.spring && data.spring.version) {
springVersionEl.textContent = data.spring.version;
} else if (data.build && data.build.springVersion) {
springVersionEl.textContent = data.build.springVersion;
} else {
springVersionEl.textContent = 'N/A';
}
// Informazioni Boot
if (data.boot && data.boot.version) {
bootVersionEl.textContent = data.boot.version;
} else if (data.build && data.build.bootVersion) {
bootVersionEl.textContent = data.build.bootVersion;
} else {
bootVersionEl.textContent = 'N/A';
}
// Informazioni Batch
if (data.batch && data.batch.version) {
batchVersionEl.textContent = data.batch.version;
} else if (data.build && data.build.batchVersion) {
batchVersionEl.textContent = data.build.batchVersion;
} else {
batchVersionEl.textContent = 'N/A';
}
// Tempo di build
if (data.build && data.build.time) {
const buildDate = new Date(data.build.time);
buildTimeEl.textContent = buildDate.toLocaleString('it-IT');
} else if (data.build && data.build.timestamp) {
const buildDate = new Date(data.build.timestamp);
buildTimeEl.textContent = buildDate.toLocaleString('it-IT');
} else {
buildTimeEl.textContent = 'N/A';
}
}
function toggleVersionInfo() {
const versionDetails = document.getElementById('versionDetails');
const toggleButton = document.getElementById('versionToggle');
if (versionDetails.style.display === 'none') {
versionDetails.style.display = 'flex';
toggleButton.textContent = '🔽 Nascondi';
} else {
versionDetails.style.display = 'none';
toggleButton.textContent = '🔼 Mostra';
}
}
// Carica i job disponibili per il lancio
function loadAvailableJobs() {
const jobSelect = document.getElementById('jobSelect');
fetch('/actuator/batch/available-jobs')
fetch('/api/batch/available-jobs')
.then(response => response.json())
.then(data => {
if (data.status === 'success' && data.jobs) {
@ -981,7 +1129,7 @@
parameters: parameters
};
fetch('/actuator/batch/launch', {
fetch('/api/batch/launch', {
method: 'POST',
headers: {
'Content-Type': 'application/json'