Correciones 15-10-2026

This commit is contained in:
Jorge Espinoza
2026-10-15 18:48:02 +02:00
parent 92781b68e5
commit 1b7e7b369a
5 changed files with 41 additions and 27 deletions
@@ -1,22 +1,31 @@
package org.palomafp.aadd.jaec.config;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class Configuracion {
private static final String RUTA_FICHERO_CONFIGURACION = "application.properties";
private static final Properties PROPIEDADES = new Properties();
// Constructor privado: de esta manera conseguimos que esta clase no se pueda
// instanciar
private Configuracion() {
}
// Cargamos el fichero de configuracion
static {
try (InputStream input = new FileInputStream("config/application.properties")) {
try (InputStream input = Configuracion.class.getClassLoader().getResourceAsStream(RUTA_FICHERO_CONFIGURACION)) {
if (input == null) {
throw new IOException("No se encuentra " + RUTA_FICHERO_CONFIGURACION + " en el classpath");
}
PROPIEDADES.load(input);
} catch (IOException e) {
throw new RuntimeException("No se pudo cargar config/application.properties", e);
throw new RuntimeException("No se pudo cargar el fichero de configuración", e);
}
}